Top Level Namespace
Defined Under Namespace
Modules: Audio, AudioState, BGMProperty, BallHandlers, BattlePlayerHelper, BitmapCache, BooleanProperty, Cache, CharacterProperty, Clipboard, Console, EdgeMasks, EncounterModifier, EncounterTypes, Enumerable, Events, FileInputMixin, FileLineData, FileOutputMixin, FileTest, FontInstaller, GifLibrary, Graphics, HiddenMoveHandlers, Input, InterpreterFieldMixin, InterpreterMixin, ItemHandlers, ItemProperty, Kernel, LevelRestriction, MEProperty, MakeshiftConsts, MapCoordsFacingProperty, MapCoordsProperty, MapFactoryHelper, MapProperty, MapSizeProperty, Marshal, MessageConfig, MessageTypes, MiniRegistry, Mouse, MoveProperty, NatureProperty, NicknameChecker, PBAnimationPlayerModule, PBColors, PBDayNight, PBDebug, PBEggGroups, PBEvolution, PBExperience, PBMoveRoute, PBNatures, PBRibbons, PBSpecies, PBTargets, PBTerrain, PBTrainerAI, PBWeather, PhoneMsgType, PlayerProperty, PokeBattle_BattleCommon, PokeBattle_BattlePlayerModule, PokeBattle_RecordedBattleModule, PokeBattle_SceneConstants, PokemonMetadata, PokemonPCList, PropertyMixin, PurifyChamberHelper, RPG, RTP, RegionMapCoordsProperty, ScreenPosHelper, ShadowText, SpeciesProperty, StringProperty, TrainerBattleProperty, TrainerPokemonProperty, TrainerTypeProperty, TypeProperty, UIHelper, UndefinedProperty, UpDownArrowMixin, WeatherEffectProperty, Win32, WindowskinProperty, Winsock
Classes: AblePokemonRestriction, AnimFrame, AnimatedBitmap, AnimatedPlane, AnimatedSprite, AnimationCanvas, AnimationNameWindow, AnimationSprite, AnimationWindow, AntiRandom, Array, ArrayCountSlider, AudioContext, AutoMosaicPokemonSprite, BabyRestriction, BallProperty, BannedItemRestriction, BannedSpeciesRestriction, BaseStatRestriction, BattleArena, BattleChallenge, BattleChallengeData, BattleChallengeType, BattleFactoryData, BattlePalace, BattleRule, BattleSwapScene, BattleSwapScreen, BattleTower, BattleType, BerryPlantMoistureSprite, BerryPlantSprite, Bitmap, BitmapDisplayWindow, BitmapSprite, BitmapWrapper, BreakingGlass, BugContestState, BushBitmap, Button, ButtonEventScene, BuyAdapter, ByteArray, CanvasAnimationWindow, CappedLevelAdjustment, ChangelingSprite, CharacterEntryHelper, Checkbox, ChooseNumberParams, ClippableSprite, ColoredPlane, CombinedLevelAdjustment, CommandList, CommandMenuButtons, CommandMenuDisplay, ControlPointSprite, ControlWindow, CustomTilemap, CustomTilemapAutotiles, CustomTilemapSprite, DarknessSprite, DependentEventSprites, DependentEvents, DirectFlowDiagram, DoubleBattle, DoubleCup, Draw_Tilemap, Dungeon, DungeonMaze, EnemyLevelAdjustment, EnumOption, EnumOption2, EnumProperty, EvasionClause, Event, EventScene, FaceWindowVX, FadeTransition, FancyCup, FightMenuButtons, FightMenuDisplay, File, FixedLevelAdjustment, FlowDiagram, FrameCountButton, FrameCountSlider, FreezeClause, Game_Character, Game_CommonEvent, Game_Event, Game_Interpreter, Game_Map, Game_Message, Game_Picture, Game_Player, Game_Screen, Game_SelfSwitches, Game_Switches, Game_System, Game_Temp, Game_Variables, GifBitmap, GifSprite, GraphicsLister, HallOfFamePC, HallOfFameScene, HallOfFameScreen, HandlerHash, Hangup, HeightRestriction, IconSprite, IconWindow, Interpolator, Interpreter, IntroEventScene, InvalidatableSprite, InverseRestriction, ItemClause, ItemHandlerHash, ItemIconSprite, ItemList, ItemLister, ItemStorageScene, ItemsDisallowedClause, Label, LargePlane, LevelAdjustment, LevelBalanceAdjustment, LightCup, LightEffect, LightEffect_Basic, LightEffect_DayNight, LightEffect_Lamp, LimitProperty, LimitStringProperty, LittleCup, LittleCupRestriction, LocationWindow, MapBottomSprite, MapData, MapLister, MapScreenScene, MapSprite, MatchHistory, MaximumLevelRestriction, Maze, MazeNode, Messages, MiniBattle, MiniBattler, MinimumLevelRestriction, MiningGame, MiningGameCounter, MiningGameCursor, MiningGameScene, MiningGameTile, ModifiedSleepClause, MosaicPokemonSprite, MosaicTransition, MoveHandlerHash, MoveProperty2, MoveRelearnerScene, MoveRelearnerScreen, MoveSelectionSprite, MusicFileLister, NegativeExtendedGameClause, NicknameClause, NodeListElement, NonEggRestriction, NonlegendaryRestriction, NonzeroLimitProperty, NotifiableRect, NumberOption, Numeric, OHKOClause, OpenLevelAdjustment, OptionalSlider, OptionalTextSlider, OrderedHash, PBAbilities, PBAnimTiming, PBAnimation, PBAnimationPlayerX, PBAnimations, PBItems, PBMove, PBMoveData, PBMoveDataOld, PBMoves, PBPokemon, PBTrainers, PBTypes, PCItemStorage, ParticleEffect, ParticleEffect_Event, ParticleSprite, Particle_Engine, PerishSongClause, PhoneDatabase, PictureEx, PictureOrigin, PictureSprite, PictureWindow, Plane, PlayerFadeAnimation, PlayerRating, PlayerRatingElo, PngAnimatedBitmap, PointInterpolator, PointPath, PointSprite, PokeBattle_Battle, PokeBattle_BattleArena, PokeBattle_BattleArenaPlayer, PokeBattle_BattlePalace, PokeBattle_BattlePalacePlayer, PokeBattle_BattlePeer, PokeBattle_BattlePlayer, PokeBattle_Battler, PokeBattle_BugContestBattle, PokeBattle_Confusion, PokeBattle_DamageState, PokeBattle_DebugScene, PokeBattle_DebugSceneNoGraphics, PokeBattle_DebugSceneNoLogging, PokeBattle_FailedMove, PokeBattle_FakeBattler, PokeBattle_Move, PokeBattle_Move_000, PokeBattle_Move_001, PokeBattle_Move_002, PokeBattle_Move_003, PokeBattle_Move_004, PokeBattle_Move_005, PokeBattle_Move_006, PokeBattle_Move_007, PokeBattle_Move_008, PokeBattle_Move_009, PokeBattle_Move_00A, PokeBattle_Move_00B, PokeBattle_Move_00C, PokeBattle_Move_00D, PokeBattle_Move_00E, PokeBattle_Move_00F, PokeBattle_Move_010, PokeBattle_Move_011, PokeBattle_Move_012, PokeBattle_Move_013, PokeBattle_Move_014, PokeBattle_Move_015, PokeBattle_Move_016, PokeBattle_Move_017, PokeBattle_Move_018, PokeBattle_Move_019, PokeBattle_Move_01A, PokeBattle_Move_01B, PokeBattle_Move_01C, PokeBattle_Move_01D, PokeBattle_Move_01E, PokeBattle_Move_01F, PokeBattle_Move_020, PokeBattle_Move_021, PokeBattle_Move_022, PokeBattle_Move_023, PokeBattle_Move_024, PokeBattle_Move_025, PokeBattle_Move_026, PokeBattle_Move_027, PokeBattle_Move_028, PokeBattle_Move_029, PokeBattle_Move_02A, PokeBattle_Move_02B, PokeBattle_Move_02C, PokeBattle_Move_02D, PokeBattle_Move_02E, PokeBattle_Move_02F, PokeBattle_Move_030, PokeBattle_Move_031, PokeBattle_Move_032, PokeBattle_Move_033, PokeBattle_Move_034, PokeBattle_Move_035, PokeBattle_Move_036, PokeBattle_Move_037, PokeBattle_Move_038, PokeBattle_Move_039, PokeBattle_Move_03A, PokeBattle_Move_03B, PokeBattle_Move_03C, PokeBattle_Move_03D, PokeBattle_Move_03E, PokeBattle_Move_03F, PokeBattle_Move_040, PokeBattle_Move_041, PokeBattle_Move_042, PokeBattle_Move_043, PokeBattle_Move_044, PokeBattle_Move_045, PokeBattle_Move_046, PokeBattle_Move_047, PokeBattle_Move_048, PokeBattle_Move_049, PokeBattle_Move_04A, PokeBattle_Move_04B, PokeBattle_Move_04C, PokeBattle_Move_04D, PokeBattle_Move_04E, PokeBattle_Move_04F, PokeBattle_Move_050, PokeBattle_Move_051, PokeBattle_Move_052, PokeBattle_Move_053, PokeBattle_Move_054, PokeBattle_Move_055, PokeBattle_Move_056, PokeBattle_Move_057, PokeBattle_Move_058, PokeBattle_Move_059, PokeBattle_Move_05A, PokeBattle_Move_05B, PokeBattle_Move_05C, PokeBattle_Move_05D, PokeBattle_Move_05E, PokeBattle_Move_05F, PokeBattle_Move_060, PokeBattle_Move_061, PokeBattle_Move_062, PokeBattle_Move_063, PokeBattle_Move_064, PokeBattle_Move_065, PokeBattle_Move_066, PokeBattle_Move_067, PokeBattle_Move_068, PokeBattle_Move_069, PokeBattle_Move_06A, PokeBattle_Move_06B, PokeBattle_Move_06C, PokeBattle_Move_06D, PokeBattle_Move_06E, PokeBattle_Move_06F, PokeBattle_Move_070, PokeBattle_Move_071, PokeBattle_Move_072, PokeBattle_Move_073, PokeBattle_Move_074, PokeBattle_Move_075, PokeBattle_Move_076, PokeBattle_Move_077, PokeBattle_Move_078, PokeBattle_Move_079, PokeBattle_Move_07A, PokeBattle_Move_07B, PokeBattle_Move_07C, PokeBattle_Move_07D, PokeBattle_Move_07E, PokeBattle_Move_07F, PokeBattle_Move_080, PokeBattle_Move_081, PokeBattle_Move_082, PokeBattle_Move_083, PokeBattle_Move_084, PokeBattle_Move_085, PokeBattle_Move_086, PokeBattle_Move_087, PokeBattle_Move_088, PokeBattle_Move_089, PokeBattle_Move_08A, PokeBattle_Move_08B, PokeBattle_Move_08C, PokeBattle_Move_08D, PokeBattle_Move_08E, PokeBattle_Move_08F, PokeBattle_Move_090, PokeBattle_Move_091, PokeBattle_Move_092, PokeBattle_Move_093, PokeBattle_Move_094, PokeBattle_Move_095, PokeBattle_Move_096, PokeBattle_Move_097, PokeBattle_Move_098, PokeBattle_Move_099, PokeBattle_Move_09A, PokeBattle_Move_09B, PokeBattle_Move_09C, PokeBattle_Move_09D, PokeBattle_Move_09E, PokeBattle_Move_09F, PokeBattle_Move_0A0, PokeBattle_Move_0A1, PokeBattle_Move_0A2, PokeBattle_Move_0A3, PokeBattle_Move_0A4, PokeBattle_Move_0A5, PokeBattle_Move_0A6, PokeBattle_Move_0A7, PokeBattle_Move_0A8, PokeBattle_Move_0A9, PokeBattle_Move_0AA, PokeBattle_Move_0AB, PokeBattle_Move_0AC, PokeBattle_Move_0AD, PokeBattle_Move_0AE, PokeBattle_Move_0AF, PokeBattle_Move_0B0, PokeBattle_Move_0B1, PokeBattle_Move_0B2, PokeBattle_Move_0B3, PokeBattle_Move_0B4, PokeBattle_Move_0B5, PokeBattle_Move_0B6, PokeBattle_Move_0B7, PokeBattle_Move_0B8, PokeBattle_Move_0B9, PokeBattle_Move_0BA, PokeBattle_Move_0BB, PokeBattle_Move_0BC, PokeBattle_Move_0BD, PokeBattle_Move_0BE, PokeBattle_Move_0BF, PokeBattle_Move_0C0, PokeBattle_Move_0C1, PokeBattle_Move_0C2, PokeBattle_Move_0C3, PokeBattle_Move_0C4, PokeBattle_Move_0C5, PokeBattle_Move_0C6, PokeBattle_Move_0C7, PokeBattle_Move_0C8, PokeBattle_Move_0C9, PokeBattle_Move_0CA, PokeBattle_Move_0CB, PokeBattle_Move_0CC, PokeBattle_Move_0CD, PokeBattle_Move_0CE, PokeBattle_Move_0CF, PokeBattle_Move_0D0, PokeBattle_Move_0D1, PokeBattle_Move_0D2, PokeBattle_Move_0D3, PokeBattle_Move_0D4, PokeBattle_Move_0D5, PokeBattle_Move_0D6, PokeBattle_Move_0D7, PokeBattle_Move_0D8, PokeBattle_Move_0D9, PokeBattle_Move_0DA, PokeBattle_Move_0DB, PokeBattle_Move_0DC, PokeBattle_Move_0DD, PokeBattle_Move_0DE, PokeBattle_Move_0DF, PokeBattle_Move_0E0, PokeBattle_Move_0E1, PokeBattle_Move_0E2, PokeBattle_Move_0E3, PokeBattle_Move_0E4, PokeBattle_Move_0E5, PokeBattle_Move_0E6, PokeBattle_Move_0E7, PokeBattle_Move_0E8, PokeBattle_Move_0E9, PokeBattle_Move_0EB, PokeBattle_Move_0EC, PokeBattle_Move_0ED, PokeBattle_Move_0EE, PokeBattle_Move_0EF, PokeBattle_Move_0F0, PokeBattle_Move_0F1, PokeBattle_Move_0F2, PokeBattle_Move_0F3, PokeBattle_Move_0F4, PokeBattle_Move_0F5, PokeBattle_Move_0F6, PokeBattle_Move_0F7, PokeBattle_Move_0F8, PokeBattle_Move_0F9, PokeBattle_Move_0FA, PokeBattle_Move_0FB, PokeBattle_Move_0FC, PokeBattle_Move_0FD, PokeBattle_Move_0FE, PokeBattle_Move_0FF, PokeBattle_Move_100, PokeBattle_Move_101, PokeBattle_Move_102, PokeBattle_Move_103, PokeBattle_Move_104, PokeBattle_Move_105, PokeBattle_Move_106, PokeBattle_Move_107, PokeBattle_Move_108, PokeBattle_Move_109, PokeBattle_Move_10A, PokeBattle_Move_10B, PokeBattle_Move_10C, PokeBattle_Move_10D, PokeBattle_Move_10E, PokeBattle_Move_10F, PokeBattle_Move_110, PokeBattle_Move_111, PokeBattle_Move_112, PokeBattle_Move_113, PokeBattle_Move_114, PokeBattle_Move_115, PokeBattle_Move_116, PokeBattle_Move_117, PokeBattle_Move_118, PokeBattle_Move_119, PokeBattle_Move_11A, PokeBattle_Move_11B, PokeBattle_Move_11C, PokeBattle_Move_11D, PokeBattle_Move_11E, PokeBattle_Move_11F, PokeBattle_Move_120, PokeBattle_Move_121, PokeBattle_Move_122, PokeBattle_Move_123, PokeBattle_Move_124, PokeBattle_Move_125, PokeBattle_Move_126, PokeBattle_Move_127, PokeBattle_Move_128, PokeBattle_Move_129, PokeBattle_Move_12A, PokeBattle_Move_12B, PokeBattle_Move_12C, PokeBattle_Move_12D, PokeBattle_Move_12E, PokeBattle_Move_12F, PokeBattle_Move_130, PokeBattle_Move_131, PokeBattle_Move_132, PokeBattle_Move_133, PokeBattle_Move_134, PokeBattle_Move_135, PokeBattle_Move_136, PokeBattle_Move_137, PokeBattle_Move_138, PokeBattle_Move_139, PokeBattle_Move_13A, PokeBattle_Move_13B, PokeBattle_Move_13C, PokeBattle_Move_13D, PokeBattle_Move_13E, PokeBattle_Move_13F, PokeBattle_Move_140, PokeBattle_Move_141, PokeBattle_Move_142, PokeBattle_Move_143, PokeBattle_Move_144, PokeBattle_Move_145, PokeBattle_Move_146, PokeBattle_Move_147, PokeBattle_Move_148, PokeBattle_Move_149, PokeBattle_Move_14A, PokeBattle_Move_14B, PokeBattle_Move_14C, PokeBattle_Move_14D, PokeBattle_Move_14E, PokeBattle_Move_14F, PokeBattle_Move_150, PokeBattle_Move_151, PokeBattle_Move_152, PokeBattle_Move_153, PokeBattle_Move_154, PokeBattle_Move_155, PokeBattle_Move_156, PokeBattle_Move_157, PokeBattle_Move_158, PokeBattle_Move_159, PokeBattle_Move_15A, PokeBattle_Move_15B, PokeBattle_Move_170, PokeBattle_Move_171, PokeBattle_Move_174, PokeBattle_Move_175, PokeBattle_Move_176, PokeBattle_Move_177, PokeBattle_Move_178, PokeBattle_Move_179, PokeBattle_Move_180, PokeBattle_Move_181, PokeBattle_Move_182, PokeBattle_Move_183, PokeBattle_Move_184, PokeBattle_Move_185, PokeBattle_Move_187, PokeBattle_Move_188, PokeBattle_Move_189, PokeBattle_Move_190, PokeBattle_Move_191, PokeBattle_Move_192, PokeBattle_Move_193, PokeBattle_Move_19A, PokeBattle_Move_1A1, PokeBattle_Move_1B9, PokeBattle_Move_1BC, PokeBattle_Move_1C9, PokeBattle_Move_1CF, PokeBattle_Move_200, PokeBattle_Move_201, PokeBattle_Move_202, PokeBattle_Move_203, PokeBattle_Move_204, PokeBattle_Move_205, PokeBattle_Move_206, PokeBattle_Move_207, PokeBattle_Move_208, PokeBattle_Move_209, PokeBattle_Move_210, PokeBattle_Move_211, PokeBattle_Move_212, PokeBattle_Move_213, PokeBattle_Move_214, PokeBattle_Move_215, PokeBattle_Move_228, PokeBattle_Move_229, PokeBattle_Move_230, PokeBattle_Move_231, PokeBattle_Move_232, PokeBattle_Move_233, PokeBattle_Move_234, PokeBattle_Move_235, PokeBattle_Move_236, PokeBattle_Move_237, PokeBattle_Move_238, PokeBattle_Move_239, PokeBattle_Move_240, PokeBattle_Move_241, PokeBattle_Move_300, PokeBattle_Move_CF0, PokeBattle_Move_CF1, PokeBattle_Move_CF10, PokeBattle_Move_CF11, PokeBattle_Move_CF12, PokeBattle_Move_CF13, PokeBattle_Move_CF14, PokeBattle_Move_CF15, PokeBattle_Move_CF19, PokeBattle_Move_CF2, PokeBattle_Move_CF21, PokeBattle_Move_CF22, PokeBattle_Move_CF23, PokeBattle_Move_CF3, PokeBattle_Move_CF5, PokeBattle_Move_CF6, PokeBattle_Move_CF8, PokeBattle_Move_CF9, PokeBattle_NullBattlePeer, PokeBattle_Pokemon, PokeBattle_RealBattlePeer, PokeBattle_RecordedBattle, PokeBattle_RecordedBattleArena, PokeBattle_RecordedBattlePalace, PokeBattle_SafariZone, PokeBattle_Scene, PokeBattle_SceneNonInteractive, PokeBattle_Struggle, PokeBattle_SuccessState, PokeBattle_Trainer, PokeBattle_UnimplementedMove, PokeSelectionCancelSprite, PokeSelectionCancelSprite2, PokeSelectionConfirmCancelSprite, PokeSelectionConfirmSprite, PokeSelectionPlaceholderSprite, PokeSelectionSprite, PokeballPlayerSendOutAnimation, PokeballSendOutAnimation, PokedexForm, PokedexFormScene, PokegearButton, PokemonBag, PokemonBagScreen, PokemonBag_Scene, PokemonBattlerSprite, PokemonBox, PokemonBoxArrow, PokemonBoxIcon, PokemonBoxPartySprite, PokemonBoxSprite, PokemonChallengeRules, PokemonDataBox, PokemonDataCopy, PokemonDataWrapper, PokemonEggHatchScene, PokemonEggHatchScreen, PokemonEncounters, PokemonEntry, PokemonEntryScene, PokemonEntryScene2, PokemonEvolutionScene, PokemonGlobalMetadata, PokemonIconSprite, PokemonLoad, PokemonLoadPanel, PokemonLoadScene, PokemonMail, PokemonMapFactory, PokemonMapMetadata, PokemonMartAdapter, PokemonMartScene, PokemonMartScreen, PokemonMenu, PokemonMenu_Scene, PokemonNestMap, PokemonNestMapScene, PokemonOption, PokemonOptionScene, PokemonPhoneScene, PokemonPokedex, PokemonPokedexScene, PokemonRegionMap, PokemonRegionMapScene, PokemonRuleSet, PokemonSave, PokemonSaveScene, PokemonScreen, PokemonScreen_Scene, PokemonSpeciesIconSprite, PokemonSprite, PokemonStorage, PokemonStorageScene, PokemonStorageScreen, PokemonStorageWithParty, PokemonSummary, PokemonSummaryScene, PokemonSystem, PokemonTemp, PokemonTradeScene, PokemonTrainerCard, PokemonTrainerCardScene, PurifyChamber, PurifyChamberPC, PurifyChamberScene, PurifyChamberScreen, PurifyChamberSet, PurifyChamberSetView, RandomStripeTransition, ReadOnlyProperty, Rect, RectInterpolator, ReflectedSprite, RegionMapSprite, RegionalStorage, RelicStoneScene, RelicStoneScreen, Reset, RestrictedSpeciesRestriction, RestrictedSpeciesSubsetRestriction, RestrictedSpeciesTeamRestriction, RpgxpMartAdapter, RuledTeam, SafariDataBox, SafariState, SameSpeciesClause, Scene_Battle, Scene_Credits, Scene_Debug, Scene_DebugIntro, Scene_Intro, Scene_Jukebox, Scene_Map, Scene_Movie, Scene_PokedexMenu, Scene_Pokegear, ScreenBorder, ScrollScreen, SelectionSprite, SelfKOClause, SelfdestructClause, SellAdapter, SerialRecord, ShrinkingPieces, SignedWordArray, SingleBattle, SingleMatch, SinglePlayerCappedLevelAdjustment, SkillSwapClause, SleepClause, Slider, SliderOption, SlotMachine, SlotMachineReel, SlotMachineScene, SlotMachineScore, Socket, SocketError, SonicBoomClause, SoulDewBattleClause, SoulDewClause, SpeciesClause, SpeciesRestriction, SplashTransition, Sprite, SpriteAnimation, SpriteFrame, SpriteMetafile, SpriteMetafilePlayer, SpriteWindow, SpriteWindowCursorRect, SpriteWindow_Base, SpriteWindow_DebugRight, SpriteWindow_Selectable, SpriteWindow_SelectableEx, SpriteWrapper, Sprite_Character, Sprite_Picture, Sprite_Shadow, Sprite_Timer, Spriteset_Map, StandardCup, StandardRestriction, StandardRules, StorageSystemPC, String, StringInput, StringOutput, SynchronizedTilemap, SynchronizedTilemapAutotiles, SynchronizedTilemapAutotilesInternal, TCPSocket, TextField, TextSlider, Thread, TileDrawingHelper, TilePuzzle, TilePuzzleCursor, TilePuzzleScene, TilemapLoader, TimerDisplay, TossItemScene, TotalLevelAdjustment, TotalLevelRestriction, TrainerBattleLister, TrainerChecker, TrainerFadeAnimation, TrainerPC, TrainerTypeLister, TrainerWalkingCharSprite, TriadCard, TriadScene, TriadScreen, TriadSquare, TriadStorage, UIControl, UIntProperty, UnevolvedFormRestriction, Viewport, VoltorbFlip, VoltorbFlipScreen, WeakHashtable, WeakRef, WeightRestriction, Win32API, Window, WindowCursorRect, Window_AdvancedCommandPokemon, Window_AdvancedCommandPokemonEx, Window_AdvancedTextPokemon, Window_CharacterEntry, Window_CommandPokemon, Window_CommandPokemonEx, Window_CommandPokemonWhiteArrow, Window_ComplexCommandPokemon, Window_DexesList, Window_DrawableCommand, Window_InputNumberPokemon, Window_Menu, Window_MultilineTextEntry, Window_PhoneList, Window_Pokedex, Window_Pokemon, Window_PokemonBag, Window_PokemonItemStorage, Window_PokemonMart, Window_PokemonOption, Window_PurifyChamberSets, Window_SimpleText, Window_TextEntry, Window_TextEntry_Keyboard, Window_UnformattedTextPokemon, WithdrawItemScene, WordArray, ZoomInTransition
Constant Summary
collapse
- FORMATREGEXP =
/<(\/?)([Cc]|[Cc][2]|[Cc][33]|[Oo]|[Ff][Nn]|[Bb][Rr]|[Ff][Ss]|[Ii]|[Bb]|[Rr]|[Pp][Gg]|[Pp][Oo][Gg]|[Uu]|[Ss]|[Ii][Cc][Oo][Nn]|[Ii][Mm][Gg]|[Aa][Cc]|[Aa][Rr]|[Aa][Ll]|[Oo][Uu][Tt][Ll][Nn]|[Oo][Uu][Tt][Ll][Nn][2])(\s*\=\s*([^>]*))?>/
- MetadataHome =
1
- MetadataWildBattleBGM =
2
- MetadataTrainerBattleBGM =
3
- MetadataWildVictoryME =
4
- MetadataTrainerVictoryME =
5
- MetadataSurfBGM =
6
- MetadataBicycleBGM =
7
- MetadataPlayerA =
8
- MetadataPlayerB =
9
- MetadataPlayerC =
10
- MetadataPlayerD =
11
- MetadataPlayerE =
12
- MetadataPlayerF =
13
- MetadataPlayerG =
14
- MetadataPlayerH =
15
- MetadataOutdoor =
1
- MetadataShowArea =
2
- MetadataBicycle =
3
- MetadataBicycleAlways =
4
- MetadataHealingSpot =
5
- MetadataWeather =
6
- MetadataMapPosition =
7
- MetadataDiveMap =
8
- MetadataDarkMap =
9
- MetadataSafariMap =
10
- MetadataSnapEdges =
11
- MetadataDungeon =
12
- MetadataBattleBack =
13
- MetadataMapWildBattleBGM =
14
- MetadataMapTrainerBattleBGM =
15
- MetadataMapWildVictoryME =
16
- MetadataMapTrainerVictoryME =
17
- MetadataMapSize =
18
- DEFAULTSCREENWIDTH =
-
El ancho de la pantalla por defecto (a escala 1.0; el tamaño es de la
mitad a escala 0.5).
-
La altura de la pantalla por defecto (a escala 1.0).
-
La escala de la pantalla por defecto (1.0 significa que cada tile es
de 32x32 pixeles, 0.5 significa que cada tile es de 16x16 pixeles,
2.0 significa que cada tile es de 64x64 pixeles).
-
Indica, en el modo de pantalla completa, si se permite que la imágen de los
bordes salga de los límites de la pantalla (true) o si se debe forzar que
la misma debe ser mostrada completamente dentro de la pantalla (false).
-
El ancho de los bordes izquierdo y derecho de la pantalla. Éstos se suman al
valor indicado como ancho de la pantalla, cuando el borde está activo.
-
La altura de los bordes superior e inferior de la pantalla. Éstos se suman
al valor indicado como altura de la pantalla, sólo cuando el borde
está activo.
-
Modo de vista del mapa (0=original, 1=personalizado, 2=perspectiva).
512
- DEFAULTSCREENHEIGHT =
384
- DEFAULTSCREENZOOM =
1.0
- FULLSCREENBORDERCROP =
false
- BORDERWIDTH =
80
- BORDERHEIGHT =
80
- MAPVIEWMODE =
1
- MAXIMUMLEVEL =
-
El nivel máximo que pueden alcanzar los Pokémon.
-
El nivel de un Pokémon al salir del huevo.
-
La probabilidad de que un Pokémon sea shiny al momento de su creación (entre 65536).
-
La probabilidad de que un Pokémon tenga Pokérus al momento de su creación (entre 65536).
100
- EGGINITIALLEVEL =
1
- SHINYPOKEMONCHANCE =
8
- POKERUSCHANCE =
3
- POISONINFIELD =
-
Indica si un Pokémon envenenado pierde PS mientras el entrenador camina.
-
Indica si un Pokémon envenenado puede debilitarse mientras el entrenador
camina (true) o si sobrevivirá con 1 PS (false).
-
Indica si, al pescar, el Pokémon es enganchado automáticamente (en false,
se agrega una prueba de reacción).
-
Indica si el jugador puede emergir en cualquier lugar cuando bucea (true)
o si puede hacerlo solamente en los mismos lugares donde puede
sumergirse (false).
-
Indica si las bayas plantadas crecen según la mecánica de la Gen 4 (true)
o de la Gen 3 (false).
-
Indica si las MTs se pueden usar infinitamente como en la Gen 5 (true)
o tiene un sólo uso como en las generaciones anteriores (false).
true
- POISONFAINTINFIELD =
false
- FISHINGAUTOHOOK =
false
- DIVINGSURFACEANYWHERE =
false
- NEWBERRYPLANTS =
true
- INFINITETMS =
true
- ENABLESHADING =
true
- NOSIGNPOSTS =
-
Par de IDs de mapas, entre los cuales no se mostrará el letrero de ubicación
cuando el jugador pasa de uno al otro (y viceversa). Usado para rutas o
pueblos grandes que se expanden sobre varios mapas.
Por ejemplo [4,5,16,17,42,43] serán pares de mapas los (4,5), (16,17) y
(42,43).
De todas formas, al pasar entre dos mapas que tienen exactamente el mismo
nombre, no se muestra el letrero de ubicación; así que no es necesario
listar aquí esos mapas.
[]
- USEMOVECATEGORY =
-
Indica si la categoría física/especial de los movimientos depende de la
definición de dicho movimiento como en las generaciones más nuevas (true)
o si depende de su tipo como en las generaciones más viejas (false).
-
Indica si la mecánica de las batallas responde a la Gen 6 (true)
o a la Gen 5 (false).
-
Indica si la Exp ganada al derrotar a un Pokémon debería ser escalada
dependiendo en el nivel de los participantes como en la Gen 5 (true),
o no, como en las generaciones anteriores (false).
-
Indica si la Exp ganada al derrotar a un Pokémon debería ser dividida
equitativamente entre los participantes (false) o si cada uno de ellos
debería ganar el total de la Exp. Esto también aplica a la Exp ganada
mediante el Repartir Exp (la versión portable) siendo repartida en todos
los que llevan Repartir Exp. Esta característica es true en la Gen 6
y false de todas las anteriores.
-
Indica si se aplica la mecánica de captura crítica (true) o no (false).
Esta mecánica se basa en un total de más de 600 especies (es decir,
cuántas especies necesitan ser capturadas para conseguir el mayor
índice de captura crítica de 2.5x), y puede haber un número menor de
especies en tu juego.
-
Indica si se gana Exp al capturar a un Pokémon (true) o no (false).
true
- USENEWBATTLEMECHANICS =
true
- USESCALEDEXPFORMULA =
true
- NOSPLITEXP =
false
- USECRITICALCAPTURE =
false
- GAINEXPFORCAPTURE =
false
- BADGESBOOSTATTACK =
-
La cantidad mínima de medallas necesarias para potencias cada una de las
características de los Pokémon del jugador en 1.1x, usado en combate.
-
Indica si la restricción del uso de ciertos movimientos ocultos depende
de la cantidad de medallas conseguidas (true) o de conseguir una medalla
en particular (false).
-
Dependiendo de HIDDENMOVESCOUNTBADGES, puede indicar la cantidad de medallas
necesarias para usar cada uno de los movimientos ocultos o el número de
la medalla específica que se necesita para poder usarlos. Recuerda que la
medalla 0 es la primera, la medalla 1 es la segunda, y así sucesivamente.
Por ejemplo: Para restringir Corte con la segunda medalla,
se usa HIDDENMOVESCOUNTBADGES = false y BADGEFORCUT = 1.
Para restringir Surf con dos medallas, se usa false y 1.
se usa HIDDENMOVESCOUNTBADGES = true y BADGEFORSURF = 2.
1
- BADGESBOOSTDEFENSE =
5
- BADGESBOOSTSPEED =
3
- BADGESBOOSTSPATK =
7
- BADGESBOOSTSPDEF =
7
- HIDDENMOVESCOUNTBADGES =
false
- BADGEFORCUT =
1
- BADGEFORROCKSMASH =
2
- BADGEFORSURF =
3
- BADGEFORFLY =
4
- BADGEFORSTRENGTH =
5
- BADGEFORDIVE =
6
- BADGEFORWATERFALL =
7
- BADGEFORROCKCLIMB =
8
- MAXPOCKETSIZE =
[0,-1,-1,-1,-1,-1,-1,-1,-1]
- BAGMAXPERSLOT =
99
- POCKETAUTOSORT =
[0,false,false,false,true,true,false,false,false]
- BERRYPOCKET =
5
- STORAGEBOXES =
28
- DEXDEPENDSONLOCATION =
-
Indica si la lista de accesos al Dex que se muestra corresponde a la región
donde se encuentra el jugador (true) o si se muestra un menú para
que el jugador elija manualmente la Dex que quiere consultar (false).
-
Los nombres de cada unos de los accesos a la Dex del juego, en orden y con
la Pokédex Nacional al final. Es el mismo orden que está en
$PokemonGlobal.pokedexUnlocked, que registra cuáles son las Dex
desbloqueadas (la primera está desbloqueada por defecto).
Se puede vincular una Dex en particular a una región. De esta forma,
al acceder a la Dex indicada, siempre se mostrará el mapa de la región
definida independientemente de la región en la que se encuentre el
jugador en ese momento. Para definir esto. Para hacer esto, se ponen en
un mismo arreglo el nombre de la Dex y el número de la región. Las Dex
de Kanto y Jotho son dos ejemplo de ésto. La Dex Nacional no se
encuentra asociada a una región, por lo que el mapa que muestre será
el de la región donde se encuentre el jugador en cada momento.
-
Indica si estarán disponibles en la Dex todas las formas que pueda tener una
especie inmediatamente desde el momento en que se encuentra una de sus
formas (true) o si es necesario avistar específicamente cada una de las
formas para registrarlas en la Dex (false).
-
Un arreglo de números, donde cada número corresponde a una Dex (la Dex
Nacional es el -1). Todas las Dex incluidas aquí tendrán el número de
especie reducido en 1, haciendo que la primer especie listada tenga el
número 0 (por ejemplo, Victini en la Dex Unova).
false
- ALWAYSSHOWALLFORMS =
false
- DEXINDEXOFFSETS =
[]
- INITIALMONEY =
-
La cantidad de dinero con la que el jugador inicia el juego.
-
La cantidad máxima de dinero que puede tener el jugador.
-
La cantidad máxima de cupones del Rincón de Juegos que se pueden llevar.
-
La cantidad máxima de Puntos de Batalla que se pueden llevar.
3000
- MAXMONEY =
999999
- MAXCOINS =
99999
- RIVALNAMES =
-
Un conjunto de arreglos que contiene un tipo de entrenador seguido del
número de una Variable Global. Si la variable no contiene un 0, entonces
todos los entrenadores asociados al tipo de entrenador indicado tendrá
el nombre que se haya establecido como valor de esa variable.
[
[:RIVAL1,12],
[:RIVAL2,12],
[:CHAMPION,12]
]
- RoamingAreas =
-
Una lista de mapas usada por Pokémon errantes. Cada mapa contiene un arreglo
de los otros mapas a los que puede saltar el Pokémon.
-
Un conjunto de arreglos que contiene los datos de un Pokémon errante.
La información que contienen es la siguiente:
- Especie.
- Nivel.
- Interruptor Global; el Pokémon está viajando mientras está encendido.
- Tipo de encuentro (0=cualquiera, 1=hierba/caminando en cueva,
2=surfeando, 3=pescando, 4=surfeando/pescando). Consulta las listas
al final de PField_RoamingPokemon.
- El nombre del BGM (Música de fondo) que se pasa en el encuentro (opcional).
- Las areas específicas donde este Pokémon puede aparecer (opcional).
{
5 => [21,28,31,39,41,44,47,66,69],
21 => [5,28,31,39,41,44,47,66,69],
28 => [5,21,31,39,41,44,47,66,69],
31 => [5,21,28,39,41,44,47,66,69],
39 => [5,21,28,31,41,44,47,66,69],
41 => [5,21,28,31,39,44,47,66,69],
44 => [5,21,28,31,39,41,47,66,69],
47 => [5,21,28,31,39,41,44,66,69],
66 => [5,21,28,31,39,41,44,47,69],
69 => [5,21,28,31,39,41,44,47,66]
}
- RoamingSpecies =
[
[:LATIAS, 30, 53, 0, "002-Battle02x"],
[:LATIOS, 30, 53, 0, "002-Battle02x"],
[:KYOGRE, 40, 54, 2, nil, {
2 => [21,31],
21 => [2,31,69],
31 => [2,21,69],
69 => [21,31]
}],
[:ENTEI, 40, 55, 1, nil]
]
- POKERADAREXCLUSIVES =
-
Un conjunto de arreglos que contiene los detalles de un encuentro salvaje
que sólo puede ocurrir mediante el uso del Poké Radar. Los datos son
los siguientes:
- ID del Mapa en el que puede ocurrir el encuentro.
- Probabilidad en la que puede ocurrir el encuentro (como un porcentaje).
- Especie.
- Nivel mínimo posible.
- Nivel máximo posible (opcional).
[
[5, 20, :STARLY, 12, 15],
[21, 10, :STANTLER, 14],
[28, 20, :BUTTERFREE, 15, 18],
[28, 20, :BEEDRILL, 15, 18]
]
[
[0,51,16,15,"mapHiddenBerth",false],
[0,52,20,14,"mapHiddenFaraday",false]
]
- SAFARISTEPS =
600
- BUGCONTESTTIME =
1200
- STARTING_OVER_SWITCH =
-
El Interruptor Global que se enciende cuando el jugador inicia el juego.
-
El Interruptor Global que se enciende cuando el jugador es informado sobre
el Pokérus en un Centro Pokémon, y no necesita que se le informe
nuevamente.
-
El Interruptor Global que, mientras está activo, hace que todos los Pokémon
salvajes sean creados con shiny.
-
El Interruptor Global que, mientras está activo, hace que todos los Pokémon
creados sean considerados como un encuentro fatídico.
-
El Interruptor Global que determina si el jugador pierde dinero cuando
pierde un combate (seguirá ganando dinero de los entrenadores que
derrote).
-
El Interruptor Global que, mientras está activo, impide que todos los
Pokémon pueden Mega evolucionar incluso cuando estén en condiciones.
1
- SEEN_POKERUS_SWITCH =
2
- SHINY_WILD_POKEMON_SWITCH =
31
- FATEFUL_ENCOUNTER_SWITCH =
32
- NO_MONEY_LOSS =
33
- NO_MEGA_EVOLUTION =
34
- NO_ULTRA_BURST =
35
- FISHINGBEGINCOMMONEVENT =
-
El ID del evento común que se ejecuta cuando el jugador saca una caña de
pescar (se ejecuta en lugar de mostrar la animación de lanzamiento).
-
El ID del evento común que se ejecuta cuando el jugador guarda una caña de
pescar (se ejecuta en lugar de mostrar la animación de recogida).
-1
- FISHINGENDCOMMONEVENT =
-1
- GRASS_ANIMATION_ID =
-
El ID de la animación mostrada cuando el jugador pasa sobre la hierba
(muestra la hierba crujiendo).
-
El ID de la animación mostrada cuando el jugador cae sobre la tierra tras
saltar una cornisa (muestra un salto de polvo).
-
El ID de la animación mostrada cuando un entrenador avista al jugador
(muestra una burbuja de exclamación).
-
El ID de la animación mostrada cuando la hierba se sacude como respuesta
al Poké Radar.
-
El ID de la animación mostrada cuando la hierba se sacude enérgicamente
como respuesta al Poké Radar (especies raras).
-
El ID de la animación mostrada cuando la hierba se sacude y brilla como
respuesta al Poké Radar (encuentro shiny).
-
El ID de la animación mostrada cuando una planta de bayas crece mientras
el jugador está en el mapa (solamente aplica para la nueva mecánica de
crecimiento de plantas).
1
- DUST_ANIMATION_ID =
2
- EXCLAMATION_ANIMATION_ID =
3
- RUSTLE_NORMAL_ANIMATION_ID =
1
- RUSTLE_VIGOROUS_ANIMATION_ID =
5
- RUSTLE_SHINY_ANIMATION_ID =
6
- PLANT_SPARKLE_ANIMATION_ID =
7
- LANGUAGES =
[
]
- USEKEYBOARDTEXTENTRY =
false
- ITEMID =
0
- ITEMNAME =
1
- ITEMPLURAL =
2
- ITEMPOCKET =
3
- ITEMPRICE =
4
- ITEMDESC =
5
- ITEMUSE =
6
- ITEMBATTLEUSE =
7
- ITEMTYPE =
8
- ITEMMACHINE =
9
- CreditsBackgroundList =
Fondos usados en los créditos. Se encuentran en la carpeta Graphics/Titles/
["credits1","credits2","credits3","credits4","credits5"]
- CreditsMusic =
"begin"
- CreditsScrollSpeed =
Al menos 1; mantenlo menor a 5 para que se pueda leer.
1
- CreditsFrequency =
Cantidad de segundos por cambio de créditos.
8
- CREDITS_OUTLINE =
Color.new(0,0,128, 255)
- CREDITS_SHADOW =
Color.new(0,0,0, 100)
- CREDITS_FILL =
Color.new(255,255,255, 255)
- SHADOW_WARN =
Sprite_Shadow (Sprite_Ombre ) Based on Genzai Kawakami's shadows, dynamisme & features by Rataime, extra features Boushy Modified by Peter O. to be compatible with Pokémon Essentials
true
- EVOLUTIONMOVES =
Define Evolution Moves Here #
{
[:VENUSAUR, 0] => [:PETALDANCE],
[:CHARIZARD, 0] => [:WINGATTACK],
[:METAPOD, 0] => [:HARDEN],
[:BUTTERFREE, 0] => [:GUST],
[:KAKUNA, 0] => [:HARDEN],
[:BEEDRILL, 0] => [:TWINEEDLE],
[:RATICATE, 0] => [:SCARYFACE],
[:RATICATE, 1] => [:SCARYFACE],
[:ARBOK, 0] => [:CRUNCH],
[:RAICHU, 1] => [:PSYCHIC],
[:SANDSLASH, 0] => [:CRUSHCLAW],
[:SANDSLASH, 1] => [:ICICLESPEAR],
[:NINETALES, 1] => [:DAZZLINGGLEAM],
[:VENOMOTH, 0] => [:GUST],
[:DUGTRIO, 0] => [:SANDTOMB],
[:DUGTRIO, 1] => [:SANDTOMB],
[:PERSIAN, 0] => [:SWIFT],
[:PERSIAN, 1] => [:SWIFT],
[:PRIMEAPE, 0] => [:RAGE],
[:POLIWRATH, 0] => [:SUBMISSION],
[:KADABRA, 0] => [:KINESIS],
[:ALAKAZAM, 0] => [:KINESIS],
[:MACHAMP, 0] => [:STRENGTH],
[:VICTREEBEL, 0] => [:LEAFTORNADO],
[:RAPIDASH, 0] => [:FURYATTACK],
[:RAPIDASH, 1] => [:PSYCHOCUT],
[:SLOWBRO, 0] => [:WITHDRAW],
[:SLOWBRO, 1] => [:SHELLSIDEARM],
[:MAGNETON, 0] => [:TRIATTACK],
[:DODRIO, 0] => [:TRIATTACK],
[:DEWGONG, 0] => [:SHEERCOLD],
[:MUK, 0] => [:VENOMDRENCH],
[:MUK, 1] => [:VENOMDRENCH],
[:HAUNTER, 0] => [:SHADOWPUNCH],
[:GENGAR, 0] => [:SHADOWPUNCH],
[:EXEGGUTOR, 0] => [:STOMP],
[:EXEGGUTOR, 1] => [:DRAGONHAMMER],
[:MAROWAK,1] => [:SHADOWBONE],
[:HITMONLEE, 0] => [:DOUBLEKICK],
[:HITMONCHAN, 0] => [:COMETPUNCH],
[:WEEZING, 0] => [:DOUBLEHIT],
[:WEEZING, 1] => [:DOUBLEHIT],
[:RHYDON, 0] => [:HAMMERARM],
[:GYARADOS, 0] => [:BITE],
[:VAPOREON, 0] => [:WATERGUN],
[:JOLTEON, 0] => [:THUNDERSHOCK],
[:FLAREON, 0] => [:EMBER],
[:OMASTAR, 0] => [:SPIKECANNON],
[:KABUTOPS, 0] => [:SLASH],
[:DRAGONITE, 0] => [:WINGATTACK],
[:MEGANIUM, 0] => [:PETALDANCE],
[:FURRET, 0] => [:AGILITY],
[:ARIADOS, 0] => [:SWORDSDANCE],
[:CROBAT, 0] => [:CROSSPOISON],
[:LANTURN, 0] => [:STOCKPILE, :SWALLOW, :SPITUP],
[:XATU, 0] => [:AIRSLASH],
[:AMPHAROS, 0] => [:THUNDERPUNCH],
[:BELLOSSOM, 0] => [:MAGICALLEAF],
[:SUDOWOODO, 0] => [:SLAM],
[:ESPEON, 0] => [:CONFUSION],
[:UMBREON, 0] => [:PURSUIT],
[:SLOWKING,1] => [:EERIESPELL],
[:FORRETRESS, 0] => [:MIRRORSHOT, :AUTOTOMIZE],
[:MAGCARGO, 0] => [:SHELLSMASH],
[:PILOSWINE, 0] => [:FURYATTACK],
[:OCTILLERY, 0] => [:OCTOZOOKA],
[:DONPHAN, 0] => [:FURYATTACK],
[:HITMONTOP, 0] => [:ROLLINGKICK],
[:GROVYLE, 0] => [:FURYCUTTER],
[:SCEPTILE, 0] => [:DUALCHOP],
[:COMBUSKEN, 0] => [:DOUBLEKICK],
[:BLAZIKEN, 0] => [:BLAZEKICK],
[:MARSHTOMP, 0] => [:MUDSHOT],
[:MIGHTYENA, 0] => [:SNARL],
[:LINOONE, 1] => [:NIGHTSLASH],
[:SILCOON, 0] => [:HARDEN],
[:BEAUTIFLY, 0] => [:GUST],
[:CASCOON, 0] => [:HARDEN],
[:DUSTOX, 0] => [:GUST],
[:NUZLEAF, 0] => [:RAZORLEAF],
[:PELIPPER, 0] => [:PROTECT],
[:BRELOOM, 0] => [:MACHPUNCH],
[:SLAKING, 0] => [:SWAGGER],
[:NINJASK, 0] => [:DOUBLETEAM, :SCREECH, :FURYCUTTER],
[:LOUDRED, 0] => [:BITE],
[:EXPLOUD, 0] => [:CRUNCH],
[:SWALOT, 0] => [:BODYSLAM],
[:SHARPEDO, 0] => [:SLASH],
[:CAMERUPT, 0] => [:ROCKSLIDE],
[:GRUMPIG, 0] => [:TEETERDANCE],
[:VIBRAVA, 0] => [:DRAGONBREATH],
[:FLYGON, 0] => [:DRAGONCLAW],
[:CACTURNE, 0] => [:SPIKYSHIELD],
[:ALTARIA, 0] => [:DRAGONBREATH],
[:WHISCASH, 0] => [:THRASH],
[:CRAWDAUNT, 0] => [:SWIFT],
[:CLAYDOL, 0] => [:HYPERBEAM],
[:MILOTIC, 0] => [:WATERPULSE],
[:DUSCLOPS, 0] => [:SHADOWPUNCH],
[:GLALIE, 0] => [:FREEZEDRY],
[:SEALEO, 0] => [:SWAGGER],
[:WALREIN, 0] => [:ICEFANG],
[:SHELGON, 0] => [:PROTECT],
[:SALAMENCE, 0] => [:FLY],
[:METANG, 0] => [:CONFUSION, :METALCLAW],
[:METAGROSS, 0] => [:HAMMERARM],
[:TORTERRA, 0] => [:EARTHQUAKE],
[:MONFERNO, 0] => [:MACHPUNCH],
[:INFERNAPE, 0] => [:CLOSECOMBAT],
[:PRINPLUP, 0] => [:METALCLAW],
[:EMPOLEON, 0] => [:AQUAJET],
[:STARAPTOR, 0] => [:CLOSECOMBAT],
[:BIBAREL, 0] => [:WATERGUN],
[:KRICKETUNE, 0] => [:FURYCUTTER],
[:RAMPARDOS, 0] => [:ENDEAVOR],
[:BASTIODON, 0] => [:BLOCK],
[:WORMADAM, 0] => [:QUIVERDANCE],
[:WORMADAM, 1] => [:QUIVERDANCE],
[:WORMADAM, 2] => [:QUIVERDANCE],
[:MOTHIM, 0] => [:QUIVERDANCE],
[:VESPIQUEN, 0] => [:SLASH],
[:CHERRIM, 0] => [:PETALDANCE],
[:LOPUNNY, 0] => [:RETURN],
[:PURUGLY, 0] => [:SWAGGER],
[:SKUNTANK, 0] => [:FLAMETHROWER],
[:BRONZONG, 0] => [:BLOCK],
[:GABITE, 0] => [:DUALCHOP],
[:GARCHOMP, 0] => [:CRUNCH],
[:LUCARIO, 0] => [:AURASPHERE],
[:MAGNEZONE, 0] => [:TRIATTACK],
[:LEAFEON, 0] => [:RAZORLEAF],
[:GLACEON, 0] => [:ICYWIND],
[:GALLADE, 0] => [:SLASH],
[:PROBOPASS, 0] => [:TRIATTACK],
[:FROSLASS, 0] => [:OMINOUSWIND],
[:PIGNITE, 0] => [:ARMTHRUST],
[:SAMUROTT, 0] => [:SLASH],
[:WATCHOG, 0] => [:CONFUSERAY],
[:BOLDORE, 0] => [:POWERGEM],
[:EXCADRILL, 0] => [:HORNDRILL],
[:SEISMITOAD, 0] => [:ACID],
[:SWADLOON, 0] => [:PROTECT],
[:LEAVANNY, 0] => [:SLASH],
[:WHIRLIPEDE, 0] => [:IRONDEFENSE],
[:SCOLIPEDE, 0] => [:BATONPASS],
[:DARMANITAN, 0] => [:HAMMERARM],
[:DARMANITAN, 1] => [:ICICLECRASH],
[:COHAGRIGUS, 0] => [:SCARYFACE],
[:ZOROARK, 0] => [:NIGHTSLASH],
[:REUNICLUS, 0] => [:DIZZYPUNCH],
[:SAWSBUCK, 0] => [:HORNLEECH],
[:SAWSBUCK, 1] => [:HORNLEECH],
[:SAWSBUCK, 2] => [:HORNLEECH],
[:SAWSBUCK, 3] => [:HORNLEECH],
[:GALVANTULA, 0] => [:STICKYWEB],
[:FERROTHORN, 0] => [:POWERWHIP],
[:KLINKLANG, 0] => [:MAGNETICFLUX],
[:EELEKTRIK, 0] => [:CRUNCH],
[:BEARTIC, 0] => [:ICICLECRASH],
[:GOLURK, 0] => [:HEAVYSLAM],
[:BRAVIARY, 0] => [:SUPERPOWER],
[:MANDIBUZZ, 0] => [:BONERUSH],
[:VOLCARONA, 0] => [:QUIVERDANCE],
[:QUILLADIN, 0] => [:NEEDLEARM],
[:CHESNAUGHT, 0] => [:SPIKYSHIELD],
[:DELPHOX, 0] => [:MYSTICALFIRE],
[:GRENINJA, 0] => [:WATERSHURIKEN],
[:FLETCHINDER, 0] => [:EMBER],
[:SPEWPA, 0] => [:PROTECT],
[:SPEWPA, 1] => [:PROTECT],
[:SPEWPA, 2] => [:PROTECT],
[:SPEWPA, 3] => [:PROTECT],
[:SPEWPA, 4] => [:PROTECT],
[:SPEWPA, 5] => [:PROTECT],
[:SPEWPA, 6] => [:PROTECT],
[:SPEWPA, 7] => [:PROTECT],
[:SPEWPA, 8] => [:PROTECT],
[:SPEWPA, 9] => [:PROTECT],
[:SPEWPA, 10] => [:PROTECT],
[:SPEWPA, 11] => [:PROTECT],
[:SPEWPA, 12] => [:PROTECT],
[:SPEWPA, 13] => [:PROTECT],
[:SPEWPA, 14] => [:PROTECT],
[:SPEWPA, 15] => [:PROTECT],
[:SPEWPA, 16] => [:PROTECT],
[:SPEWPA, 17] => [:PROTECT],
[:SPEWPA, 18] => [:PROTECT],
[:SPEWPA, 19] => [:PROTECT],
[:VIVILLON, 0] => [:GUST],
[:VIVILLON, 1] => [:GUST],
[:VIVILLON, 2] => [:GUST],
[:VIVILLON, 3] => [:GUST],
[:VIVILLON, 4] => [:GUST],
[:VIVILLON, 5] => [:GUST],
[:VIVILLON, 6] => [:GUST],
[:VIVILLON, 7] => [:GUST],
[:VIVILLON, 8] => [:GUST],
[:VIVILLON, 9] => [:GUST],
[:VIVILLON, 10] => [:GUST],
[:VIVILLON, 11] => [:GUST],
[:VIVILLON, 12] => [:GUST],
[:VIVILLON, 13] => [:GUST],
[:VIVILLON, 14] => [:GUST],
[:VIVILLON, 15] => [:GUST],
[:VIVILLON, 16] => [:GUST],
[:VIVILLON, 17] => [:GUST],
[:VIVILLON, 18] => [:GUST],
[:VIVILLON, 19] => [:GUST],
[:GOGOAT, 0] => [:AERIALACE],
[:PANGORO, 0] => [:BULLETPUNCH],
[:DRAGALGE, 0] => [:TWISTER],
[:CLAWITZER, 0] => [:AURASPHERE],
[:TYRANTRUM, 0] => [:ROCKSLIDE],
[:AURORUS, 0] => [:FREEZEDRY],
[:SYLVEON, 0] => [:FAIRYWIND],
[:GOODRA, 0] => [:AQUATAIL],
[:TREVENANT, 0] => [:SHADOWCLAW],
[:AVALUGG, 0] => [:BODYSLAM],
[:DECIDUEYE, 0] => [:SPIRITSHACKLE],
[:INCINEROAR, 0] => [:DARKESTLARIAT],
[:PRIMARINA, 0] => [:SPARKLINGARIA],
[:TOUCANNON, 0] => [:BEAKBLAST],
[:CHARJABUG, 0] => [:CHARGE],
[:VIKAVOLT, 0] => [:THUNDERBOLT],
[:CRABOMINABLE, 0] => [:ICEPUNCH],
[:RIBOMBEE, 0] => [:POLLENPUFF],
[:LYCANROC, 0] => [:ACCELEROCK],
[:LYCANROC, 1] => [:COUNTER],
[:LYCANROC, 2] => [:THRASH],
[:TOXAPEX, 0] => [:BANEFULBUNKER],
[:LURANTIS, 0] => [:PETALBLIZZARD],
[:SALAZZLE, 0] => [:CAPTIVATE],
[:BEWEAR, 0] => [:BIND],
[:STEENEE, 0] => [:DOUBLESLAP],
[:TSAREENA, 0] => [:TROPKICK],
[:GOLISOPOD, 0] => [:FIRSTIMPRESSION],
[:SILVALLY, 0] => [:MULTIATTACK],
[:HAKAMOO, 0] => [:SKYUPPERCUT],
[:KOMMOO, 0] => [:CLANGINGSCALES],
[:COSMOEM, 0] => [:COSMICPOWER],
[:SOLGALEO, 0] => [:SUNSTEELSTRIKE],
[:LUNALA, 0] => [:MOONGEISTBEAM],
[:MELMETAL, 0] => [:THUNDERPUNCH],
[:THWACKEY, 0] => [:DOUBLEHIT],
[:RILLABOOM, 0] => [:DRUMBEATING],
[:CINDERACE, 0] => [:PYROBALL],
[:INTELEON, 0] => [:SNIPESHOT],
[:GREEDENT, 0] => [:COVET],
[:CORVIKNIGHT, 0] => [:STEELWING],
[:DOTTLER, 0] => [:CONFUSION,:LIGHTSCREEN,:REFLECT],
[:THIEVUL, 0] => [:THIEF],
[:DREDNAW, 0] => [:ROCKTOMB],
[:CARKOL, 0] => [:FLAMECHARGE],
[:COALOSSAL, 0] => [:TARSHOT],
[:FLAPPLE, 0] => [:WINGATTACK],
[:APPLETUN, 0] => [:HEADBUTT],
[:TOXTRICITY, 0] => [:SPARK],
[:TOXTRICITY, 1] => [:SPARK],
[:GRAPPLOCT, 0] => [:OCTOLOCK],
[:POLTEAGEIST, 0] => [:TEATIME],
[:HATTREM, 0] => [:BRUTALSWING],
[:HATTERENE, 0] => [:PSYCHOCUT],
[:MORGREM, 0] => [:FALSESURRENDER],
[:GRIMMSNARL, 0] => [:SPIRITBREAK],
[:OBSTAGOON, 1] => [:OBSTRUCT],
[:PERRSERKER, 2] => [:IRONHEAD],
[:SIRFETCHD, 1] => [:IRONDEFENSE],
[:RUNERIGUS, 1] => [:SHADOWCLAW],
[:ALCREMIE, 0] => [:DECORATE],
[:FROSMOTH, 0] => [:ICYWIND],
[:COPPERAJAH, 0] => [:HEAVYSLAM],
[:DRAKLOAK, 0] => [:DRAGONPULSE],
[:DRAGAPULT, 0] => [:DRAGONDARTS],
[:URSHIFU,0] => [:WICKEDBLOW],
[:URSHIFU,1] => [:SURGINGSTRIKES]
}
- MYSTERYGIFTURL =
Mystery Gift system By Maruno
This url is the location of an example Mystery Gift file. You should change it to your file's url once you upload it.
"http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt"
- TPSPECIES =
0
- TPLEVEL =
1
- TPITEM =
2
- TPMOVE1 =
3
- TPMOVE2 =
4
- TPMOVE3 =
5
- TPMOVE4 =
6
- TPABILITY =
7
- TPGENDER =
8
- TPFORM =
9
- TPSHINY =
10
- TPNATURE =
11
- TPIV =
12
- TPHAPPINESS =
13
- TPNAME =
14
- TPSHADOW =
15
- TPBALL =
16
- TPDEFAULTS =
[0,10,0,0,0,0,0,nil,nil,0,false,nil,10,70,nil,false,0]
Instance Method Summary
collapse
-
#_I(str) ⇒ Object
-
#_INTL(*arg) ⇒ Object
Replaces first argument with a localized version and formats the other parameters by replacing 1, 2, etc.
-
#_ISPRINTF(*arg) ⇒ Object
Replaces first argument with a localized version and formats the other parameters by replacing 1, 2, etc.
-
#_MAPINTL(mapid, *arg) ⇒ Object
-
#_MAPISPRINTF(mapid, *arg) ⇒ Object
-
#addBackgroundOrColoredPlane(sprites, planename, background, color, viewport = nil) ⇒ Object
Adds a background to the sprite hash.
-
#addBackgroundPlane(sprites, planename, background, viewport = nil) ⇒ Object
Adds a background to the sprite hash.
-
#addMove(moves, move, base) ⇒ Object
-
#adjustBattleSpriteY(sprite, species, index, metrics = nil) ⇒ Object
-
#animationEditorMain(animation) ⇒ Object
-
#applyPages(page, pages) ⇒ Object
-
#at_exit(&block) ⇒ Object
-
#Audio_bgm_fade(ms) ⇒ Object
-
#Audio_bgm_fadein(ms) ⇒ Object
-
#Audio_bgm_get_position ⇒ Object
-
#Audio_bgm_get_volume ⇒ Object
-
#Audio_bgm_name ⇒ Object
-
#Audio_bgm_pitch ⇒ Object
-
#Audio_bgm_play(name, volume, pitch, position = 0) ⇒ Object
-
#Audio_bgm_playing? ⇒ Boolean
-
#Audio_bgm_set_volume(volume) ⇒ Object
-
#Audio_bgm_stop ⇒ Object
-
#Audio_bgs_fade(ms) ⇒ Object
-
#Audio_bgs_play(name, volume, pitch, position = 0) ⇒ Object
-
#Audio_bgs_stop ⇒ Object
-
#Audio_me_fade(ms) ⇒ Object
-
#Audio_me_play(name, volume, pitch, position = 0) ⇒ Object
-
#Audio_me_stop ⇒ Object
-
#Audio_se_play(name, volume, pitch, position = 0) ⇒ Object
-
#Audio_se_stop ⇒ Object
-
#babySpecies(move) ⇒ Object
-
#baseStatTotal(move) ⇒ Object
-
#bltMinimapAutotile(dstBitmap, x, y, srcBitmap, id) ⇒ Object
-
#calcPoint(x, y, distance, angle) ⇒ Object
-
#canonicalize(c) ⇒ Object
-
#catmullRom(p1, p2, p3, p4, t) ⇒ Object
-
#checkEnumField(ret, enumer) ⇒ Object
-
#chooseMapPoint(map, rgnmap = false) ⇒ Object
-
#coloredToFormattedText(text, baseColor = nil, shadowColor = nil) ⇒ Object
Deprecated – not to be used in new code.
-
#colorToRgb16(color) ⇒ Object
-
#colorToRgb32(color) ⇒ Object
-
#createMinimap(mapid) ⇒ Object
-
#createMinimap2(mapid) ⇒ Object
-
#createRegionMap(map) ⇒ Object
-
#csvBoolean!(str, line = -1)) ⇒ Object
-
#csvEnumField!(value, enumer, key, section) ⇒ Object
-
#csvEnumFieldOrInt!(value, enumer, key, section) ⇒ Object
-
#csvfield!(str) ⇒ Object
Análisis csv ===============================================================================.
-
#csvFloat!(str, key, section) ⇒ Object
-
#csvInt!(str, line = -1)) ⇒ Object
-
#csvPosInt!(str, line = -1)) ⇒ Object
-
#csvquote(str) ⇒ Object
-
#ctag(color) ⇒ Object
-
#curveToPointPath(curve, numpoints) ⇒ Object
-
#decodeInt(strm) ⇒ Object
-
#decodeString(strm) ⇒ Object
-
#drawBitmapBuffer(chars) ⇒ Object
-
#drawColoredTextEx(bitmap, x, y, width, text, baseColor = nil, shadowColor = nil) ⇒ Object
Deprecated – not to be used in new code.
-
#drawFormattedChars(bitmap, chars) ⇒ Object
-
#drawFormattedTextEx(bitmap, x, y, width, text, baseColor = nil, shadowColor = nil) ⇒ Object
-
#drawSingleFormattedChar(bitmap, ch) ⇒ Object
-
#drawTextEx(bitmap, x, y, width, numlines, text, baseColor, shadowColor) ⇒ Object
-
#drawTextExMulti(bitmap, x, y, width, numlines, text, baseColor, shadowColor) ⇒ Object
-
#drawTextTable(bitmap, x, y, totalWidth, rowHeight, columnWidthPercents, table) ⇒ Object
-
#dumpBase64Anim(s) ⇒ Object
-
#encodeInt(strm, value) ⇒ Object
-
#encodeString(strm, str) ⇒ Object
-
#evolutions(move) ⇒ Object
-
#exit(code = 0) ⇒ Object
-
#findIndex(a) ⇒ Object
-
#fmtescape(text) ⇒ Object
-
#frozenArrayValue(arr) ⇒ Object
-
#getBattleSpriteMetricOffset(species, index, metrics = nil) ⇒ Object
Ajustes de la posición del sprite ===============================================================================.
-
#getCatmullRomPoint(src, t) ⇒ Object
-
#getConstantName(mod, value) ⇒ Object
-
#getContrastColor(color) ⇒ Object
-
#getCubicPoint2(src, t) ⇒ Object
-
#getCurvePoint(src, t) ⇒ Object
-
#getDefaultTextColors(windowskin) ⇒ Object
-
#getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = 32, newlineBreaks = true, explicitBreaksOnly = false, collapseAlignments = false) ⇒ Object
Formats a string of text and returns an array containing a list of formatted characters.
-
#getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight, newlineBreaks = true, explicitBreaksOnly = false) ⇒ Object
-
#getFormattedTextForDims(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight, newlineBreaks = true, explicitBreaksOnly = false) ⇒ Object
-
#getKnownFolder(guid) ⇒ Object
-
#getLastColors(colorstack, opacitystack, defaultcolors) ⇒ Object
-
#getLastParam(array, default) ⇒ Object
-
#getLineBrokenChunks(bitmap, value, width, dims, plain = false) ⇒ Object
-
#getLineBrokenText(bitmap, value, width, dims) ⇒ Object
-
#getMapNameList ⇒ Object
-
#getPassabilityMinimap(mapid) ⇒ Object
-
#getPlayMusic ⇒ Object
-
#getPlaySound ⇒ Object
-
#getSkinColor(windowskin, color, isDarkSkin) ⇒ Object
-
#getSpriteCenter(sprite) ⇒ Object
-
#getTypes(species) ⇒ Object
-
#getUnicodeString(addr) ⇒ Object
-
#getUnicodeStringFromAnsi(addr) ⇒ Object
-
#hasMorePowerfulMove(moves, thismove) ⇒ Object
-
#intSize(value) ⇒ Object
Cifrado y decrifrado ===============================================================================.
-
#isBattlePokemonDuplicate(pk, pk2) ⇒ Object
-
#isDarkBackground(background, rect = nil) ⇒ Object
-
#isDarkWindowskin(windowskin) ⇒ Object
-
#isLikelyCounter?(thisEvent, otherEvent, mapID, mapdata) ⇒ Boolean
-
#isLikelyPassage?(thisEvent, mapID, mapdata) ⇒ Boolean
-
#isPlainEvent?(event) ⇒ Boolean
-
#isPlainEventOrMart?(event) ⇒ Boolean
-
#isReversed(src0, src1, dst0, dst1) ⇒ Object
-
#isWaitChar(x) ⇒ Object
-
#itemIconTag(item) ⇒ Object
-
#jumpFancy(follower, direction) ⇒ Object
-
#loadBase64Anim(s) ⇒ Object
-
#mainFunction ⇒ Object
-
#mainFunctionDebug ⇒ Object
-
#minimumLevel(move) ⇒ Object
-
#moonphase(time = nil) ⇒ Object
Fases de la Luna y Zodíaco =============================================================================== Determina la fase de la luna.
-
#moveData(move) ⇒ Object
-
#moveFancy(follower, direction) ⇒ Object
-
#moveThrough(follower, direction) ⇒ Object
-
#normalizeConnectionPoint(conn) ⇒ Object
-
#parseItem(item) ⇒ Object
-
#parseMove(item) ⇒ Object
-
#parseNature(item) ⇒ Object
-
#parseSpecies(item) ⇒ Object
-
#parseTrainer(item) ⇒ Object
-
#passable?(passages, tile_id) ⇒ Boolean
-
#pbActivateWindow(sprites, key) ⇒ Object
Activates a specific window of a sprite hash.
-
#pbAddDependency(event) ⇒ Object
-
#pbAddDependency2(eventID, eventName, commonEvent) ⇒ Object
-
#pbAddPassageList(event, mapdata) ⇒ Object
-
#pbAddRgssScriptTexts(items, script) ⇒ Object
-
#pbAddScript(script, sectionname) ⇒ Object
-
#pbAddScriptTexts(items, script) ⇒ Object
-
#pbAlphaBlend(dstColor, srcColor) ⇒ Object
-
#pbAnimationEditor ⇒ Object
-
#pbAnimationsOrganiser ⇒ Object
Debug option for rearranging animations.
-
#pbAnimList(animations, canvas, animwin) ⇒ Object
-
#pbAnimName(animation, cmdwin) ⇒ Object
-
#pbApplyEVGain(pokemon, ev, evgain) ⇒ Object
-
#pbArrangeByTier(pokemonlist, rule) ⇒ Object
The Pokemon list is already roughly arranged by rank from weakest to strongest.
-
#pbAutoplayOnSave ⇒ Object
-
#pbAutoplayOnTransition ⇒ Object
-
#pbBalancedLevelFromBST(species) ⇒ Object
-
#pbBallTypeToBall(balltype) ⇒ Object
-
#pbBaseStatTotal(species) ⇒ Object
-
#pbBatteryLow? ⇒ Boolean
-
#pbBattleAnimation(bgm = nil, trainerid = -1,, trainername = "") ⇒ Object
-
#pbBattleAnimationOverride(viewport, trainerid = -1,, trainername = "") ⇒ Object
Alias and use this method if you want to add a custom battle intro animation e.g.
-
#pbBattleArenaRules(openlevel) ⇒ Object
-
#pbBattleChallenge ⇒ Object
-
#pbBattleChallengeBattle ⇒ Object
-
#pbBattleChallengeBeginSpeech ⇒ Object
-
#pbBattleChallengeGraphic(event) ⇒ Object
-
#pbBattleChallengeTrainer(numwins, bttrainers) ⇒ Object
-
#pbBattleFactoryPokemon(rule, numwins, numswaps, rentals) ⇒ Object
-
#pbBattleFactoryRules(double, openlevel) ⇒ Object
-
#pbBattleHPItem(pokemon, battler, restorehp, scene) ⇒ Object
-
#pbBattleOnStepTaken ⇒ Object
-
#pbBattlePalaceRules(double, openlevel) ⇒ Object
-
#pbBattleRestorePP(pokemon, battler, move, pp) ⇒ Object
-
#pbBattleTowerRules(double, openlevel) ⇒ Object
-
#pbBerryPlant ⇒ Object
-
#pbBGMFade(x = 0.0) ⇒ Object
Fades out or stops BGM playback.
-
#pbBGMPlay(param, volume = nil, pitch = nil) ⇒ Object
-
#pbBGMStop(timeInSeconds = 0.0) ⇒ Object
Fades out or stops BGM playback.
-
#pbBGSFade(x = 0.0) ⇒ Object
Fades out or stops BGS playback.
-
#pbBGSPlay(param, volume = nil, pitch = nil) ⇒ Object
-
#pbBGSStop(timeInSeconds = 0.0) ⇒ Object
Fades out or stops BGS playback.
-
#pbBikeCheck ⇒ Object
-
#pbBitmapName(x) ⇒ Object
Finds the real path for an image file.
-
#pbBottomLeft(window) ⇒ Object
-
#pbBottomLeftLines(window, lines, width = nil) ⇒ Object
-
#pbBottomRight(window) ⇒ Object
-
#pbBridgeOff ⇒ Object
-
#pbBridgeOn(height = 2) ⇒ Object
Bridges ===============================================================================.
-
#pbBugContestBattle(species, level) ⇒ Object
-
#pbBugContestDecided? ⇒ Boolean
Returns true if the Bug Catching Contest in progress and is being judged.
-
#pbBugContestScore(pokemon) ⇒ Object
Returns a score for this Pokemon in the Bug Catching Contest.
-
#pbBugContestState ⇒ Object
-
#pbBugContestUndecided? ⇒ Boolean
Returns true if the Bug Catching Contest in progress and has not yet been judged.
-
#pbButtonInputProcessing(variableNumber = 0, timeoutFrames = 0) ⇒ Object
-
#pbBuyTriads ⇒ Object
-
#pbCallTitle ⇒ Object
-
#pbCallTrainer(trtype, trname) ⇒ Object
-
#pbCanUseBike?(mapid) ⇒ Boolean
-
#pbCanUsePokeRadar? ⇒ Boolean
-
#pbCaveEntrance ⇒ Object
-
#pbCaveEntranceEx(exiting) ⇒ Object
-
#pbCaveExit ⇒ Object
-
#pbCellBatch(canvas) ⇒ Object
-
#pbCellProperties(canvas) ⇒ Object
-
#pbChangeLevel(pokemon, newlevel, scene) ⇒ Object
-
#pbChangeMaximum(canvas) ⇒ Object
-
#pbChangeScript(script, re) ⇒ Object
-
#pbChangeScripts(script) ⇒ Object
-
#pbChatter(pokemon) ⇒ Object
-
#pbCheckAllFainted ⇒ Object
-
#pbCheckByte(x, valuename) ⇒ Object
Revisión de valores válidos ===============================================================================.
-
#pbCheckCounters(map, mapID, mapdata) ⇒ Object
-
#pbCheckEvolution(pokemon, item = 0) ⇒ Object
Revisa si un Pokémon puede evolucionar ahora.
-
#pbCheckEvolutionEx(pokemon) ⇒ Object
Revisa si un Pokémon puede evolucionar ahora.
-
#pbCheckSignedByte(x, valuename) ⇒ Object
-
#pbCheckSignedWord(x, valuename) ⇒ Object
-
#pbCheckUseOnPokemon(item, pokemon, screen) ⇒ Object
-
#pbCheckWord(x, valuename) ⇒ Object
-
#pbChooseAbilityList(defaultAbilityID = 0) ⇒ Object
Displays a sorted list of abilities, and returns the ID of the ability selected or 0 if the selection was canceled.
-
#pbChooseBallList(defaultMoveID = -1)) ⇒ Object
-
#pbChooseItemFromList(message, variable, *args) ⇒ Object
Muestra una lista de objetos de dónde elegir, se guarda el ID del objeto elegido en la Variable Global determinada.
-
#pbChooseItemList(defaultItemID = 0) ⇒ Object
Displays a sorted list of items, and returns the ID of the item selected or 0 if the selection was canceled.
-
#pbChooseLanguage ⇒ Object
-
#pbChooseMoveList(defaultMoveID = 0) ⇒ Object
Displays a sorted list of moves, and returns the ID of the move selected or 0 if the selection was canceled.
-
#pbChooseMoveListForSpecies(species, defaultMoveID = 0) ⇒ Object
-
#pbChooseNum(cel) ⇒ Object
Pop-up menus for individual cels.
-
#pbChooseNumber(msgwindow, params) ⇒ Object
-
#pbChooseSpecies(default) ⇒ Object
-
#pbChooseSpeciesList(defaultItemID = 0) ⇒ Object
Displays a sorted list of Pokémon species, and returns the ID of the species selected or 0 if the selection was canceled.
-
#pbChooseSpeciesOrdered(default) ⇒ Object
-
#pbChooseTypeList(defaultMoveID = 0, movetype = false) ⇒ Object
-
#pbClearData ⇒ Object
-
#pbClearFrames(canvas) ⇒ Object
-
#pbClosestHiddenItem ⇒ Object
-
#pbCommands2(cmdwindow, commands, cmdIfCancel, defaultindex = -1,, noresize = false) ⇒ Object
-
#pbCommands3(cmdwindow, commands, cmdIfCancel, defaultindex = -1,, noresize = false) ⇒ Object
-
#pbCompileAbilities ⇒ Object
Compilación de las habilidades ===============================================================================.
-
#pbCompileAllData(mustcompile) ⇒ Object
Compilación de todos los datos ===============================================================================.
-
#pbCompileAnimations ⇒ Object
Compilación de las animaciones de batalla ===============================================================================.
-
#pbCompileBerryPlants ⇒ Object
Compilación de las plantas de bayas ===============================================================================.
-
#pbCompileBTTrainers(filename) ⇒ Object
Compilación de los entrenadores/Pokémon de la Torre de Batalla y las demás Copas ===============================================================================.
-
#pbCompileConnections ⇒ Object
Compilación de las conexiones de los mapas ===============================================================================.
-
#pbCompileEncounters ⇒ Object
Compilación de los encuentros con Pokémon salvajes ===============================================================================.
-
#pbCompileItems ⇒ Object
-
#pbCompileMachines ⇒ Object
-
#pbCompileMetadata ⇒ Object
-
#pbCompileMoves ⇒ Object
-
#pbCompilePhoneData ⇒ Object
Compilación de los mensajes del celular ===============================================================================.
-
#pbCompilePokemonData ⇒ Object
Compilación de los Pokémon ===============================================================================.
-
#pbCompilerEachCommentedLine(filename) ⇒ Object
-
#pbCompilerEachPreppedLine(filename) ⇒ Object
-
#pbCompileShadowMoves ⇒ Object
Compilación de los movimientos Oscuros ===============================================================================.
-
#pbCompileText ⇒ Object
-
#pbCompileTextUI ⇒ Object
-
#pbCompileTownMap ⇒ Object
Compilación de los puntos del mapa de pueblos ===============================================================================.
-
#pbCompileTrainerEvents(mustcompile) ⇒ Object
-
#pbCompileTrainerLists ⇒ Object
-
#pbCompileTrainers ⇒ Object
-
#pbCompileTypes ⇒ Object
-
#pbConfigureFullScreen ⇒ Object
-
#pbConfigureWindowedScreen(value) ⇒ Object
-
#pbConsumeItemInBattle(bag, item) ⇒ Object
-
#pbConvertAnimsToNewFormat ⇒ Object
-
#pbConvertAnimToNewFormat(textdata) ⇒ Object
-
#pbConvertRPGAnimation(animation) ⇒ Object
-
#pbConvertToItemEvent(event) ⇒ Object
-
#pbConvertToTrainerEvent(event, trainerChecker) ⇒ Object
-
#pbConvertTrainerData ⇒ Object
-
#pbCopyBitmap(dstbm, srcbm, x, y, opacity = 255) ⇒ Object
-
#pbCopyFrames(canvas) ⇒ Object
-
#pbCreateCel(x, y, pattern, focus = 4) ⇒ Object
-
#pbCreateMysteryGift(type, item) ⇒ Object
-
#pbCriticalCode ⇒ Object
-
#pbCsvField!(str) ⇒ Object
-
#pbCsvPosInt!(str) ⇒ Object
-
#pbCueBGM(bgm, seconds, volume = nil, pitch = nil) ⇒ Object
Audio playing ===============================================================================.
-
#pbCurrentEventCommentInput(elements, trigger) ⇒ Object
-
#pbDayCareChoose(text, variable) ⇒ Object
-
#pbDayCareCompatibleGender(pokemon1, pokemon2) ⇒ Object
-
#pbDayCareDeposit(index) ⇒ Object
-
#pbDayCareDeposited ⇒ Object
-
#pbDayCareGenerateEgg ⇒ Object
-
#pbDayCareGetCompat ⇒ Object
-
#pbDayCareGetCompatibility(variable) ⇒ Object
-
#pbDayCareGetDeposited(index, nameVariable, costVariable) ⇒ Object
-
#pbDayCareGetLevelGain(index, nameVariable, levelVariable) ⇒ Object
-
#pbDayCareWithdraw(index) ⇒ Object
-
#pbDayNightTint(object) ⇒ Object
-
#pbDeactivateWindows(sprites) ⇒ Object
-
#pbDebugF7 ⇒ Object
-
#pbDebugMenu ⇒ Object
-
#pbDebugPlayBattle ⇒ Object
-
#pbDebugScreen(mode) ⇒ Object
-
#pbDebugSetVariable(id, diff) ⇒ Object
-
#pbDebugVariableScreen(id) ⇒ Object
-
#pbDecideWinner(party0, party1, rating0, rating1) ⇒ Object
-
#pbDecideWinnerEffectiveness(move, otype1, otype2, ability, scores) ⇒ Object
-
#pbDecideWinnerScore(party0, party1, rating) ⇒ Object
-
#pbDefaultMap ⇒ Object
-
#pbDefinePath(canvas) ⇒ Object
-
#pbDeregisterPartner ⇒ Object
-
#pbDexDataOffset(dexdata, species, offset) ⇒ Object
-
#pbDexNames ⇒ Object
-
#pbDisplayCoinsWindow(msgwindow, goldwindow) ⇒ Object
-
#pbDisplayGoldWindow(msgwindow) ⇒ Object
-
#pbDisplayMail(mail, bearer = nil) ⇒ Object
-
#pbDisposed?(x) ⇒ Boolean
-
#pbDisposeSprite(sprites, id) ⇒ Object
Disposes the specified graphics object within the specified hash.
-
#pbDisposeSpriteHash(sprites) ⇒ Object
Disposes all objects in the specified hash.
-
#pbDoEnsureBitmap(bitmap, dwidth, dheight) ⇒ Object
-
#pbDoubleTrainerBattle(trainerid1, trainername1, trainerparty1, endspeech1, trainerid2, trainername2, trainerparty2, endspeech2, canlose = false, variable = nil) ⇒ Object
-
#pbDoubleWildBattle(species1, level1, species2, level2, variable = nil, canescape = true, canlose = false) ⇒ Object
-
#pbDownloadData(url, filename = nil, depth = 0) ⇒ Object
-
#pbDownloadMysteryGift(trainer) ⇒ Object
Downloads all available Mystery Gifts that haven't been downloaded yet.
-
#pbDownloadToFile(url, file) ⇒ Object
-
#pbDownloadToString(url) ⇒ Object
-
#pbDrawGauge(bitmap, rect, color, value, maxValue) ⇒ Object
General purpose utilities.
-
#pbDrawImagePositions(bitmap, textpos) ⇒ Object
-
#pbDrawOutlineText(bitmap, x, y, width, height, string, baseColor, shadowColor = nil, align = 0) ⇒ Object
-
#pbDrawShadow(bitmap, x, y, width, height, string) ⇒ Object
-
#pbDrawShadowText(bitmap, x, y, width, height, string, baseColor, shadowColor = nil, align = 0) ⇒ Object
-
#pbDrawTextPositions(bitmap, textpos) ⇒ Object
-
#pbDynamicItemList(*args) ⇒ Object
-
#pbEachCommentedLine(f) ⇒ Object
-
#pbEachFileSection(f) ⇒ Object
-
#pbEachFileSectionEx(f) ⇒ Object
-
#pbEachIntlSection(file) ⇒ Object
-
#pbEachNaturalMove(pokemon) ⇒ Object
-
#pbEachPage(e) ⇒ Object
-
#pbEachPreppedLine(f) ⇒ Object
-
#pbEachSection(f) ⇒ Object
-
#pbEditBG(canvas, timing) ⇒ Object
-
#pbEditEncounterType(enc, etype) ⇒ Object
-
#pbEditMysteryGift(type, item, id = 0, giftname = "") ⇒ Object
Creating a new Mystery Gift for the Master file, and editing an existing one.
-
#pbEditorScreen ⇒ Object
-
#pbEggGenerated? ⇒ Boolean
-
#pbEmergencySave ⇒ Object
-
#pbEncounter(enctype) ⇒ Object
-
#pbEncounterEditorDensity(enc) ⇒ Object
-
#pbEncounterEditorMap(encdata, map) ⇒ Object
-
#pbEncounterEditorTypes(enc, enccmd) ⇒ Object
Encounters editor / Editor de encuentros.
-
#pbEncounterSpecies(phonenum) ⇒ Object
-
#pbEndSurf(xOffset, yOffset) ⇒ Object
-
#pbEnterBoxName(helptext, minlength, maxlength, initialText = "", nofadeout = false) ⇒ Object
-
#pbEnterNPCName(helptext, minlength, maxlength, initialText = "", id = 0, nofadeout = false) ⇒ Object
-
#pbEnterPlayerName(helptext, minlength, maxlength, initialText = "", nofadeout = false) ⇒ Object
-
#pbEnterPokemonName(helptext, minlength, maxlength, initialText = "", pokemon = nil, nofadeout = false) ⇒ Object
-
#pbEnterText(helptext, minlength, maxlength, initialText = "", mode = 0, pokemon = nil, nofadeout = false) ⇒ Object
-
#pbEntireSlide(canvas) ⇒ Object
-
#pbEntryScreen(*arg) ⇒ Object
-
#pbEraseEscapePoint ⇒ Object
-
#pbEventCanReachPlayer?(event, player, distance) ⇒ Boolean
-
#pbEventCommentInput(*args) ⇒ Object
-
#pbEventFacesPlayer?(event, player, distance) ⇒ Boolean
-
#pbEventId(event) ⇒ Object
-
#pbEventIsEmpty?(e) ⇒ Boolean
-
#pbEventScreen(cls) ⇒ Object
-
#pbEvoDebug ⇒ Object
-
#pbEvolutionCheck(currentlevels) ⇒ Object
-
#pbExportAnim(animations) ⇒ Object
-
#pbExtractText ⇒ Object
-
#pbExtractTrainers ⇒ Object
-
#pbFacingEachOther(event1, event2) ⇒ Object
-
#pbFacingTile(direction = nil, event = nil) ⇒ Object
-
#pbFacingTileRegular(direction = nil, event = nil) ⇒ Object
-
#pbFadeInAndShow(sprites, visiblesprites = nil) ⇒ Object
-
#pbFadeOutAndHide(sprites) ⇒ Object
-
#pbFadeOutIn(z, nofadeout = false) ⇒ Object
pbFadeOutIn(z) { block } Fades out the screen before a block is run and fades it back in after the block exits.
-
#pbFancyCupRules(double) ⇒ Object
-
#pbFancyMoveTo(follower, newX, newY) ⇒ Object
-
#pbFastInspect(pkmn, moves, species, items, natures) ⇒ Object
-
#pbFindEncounter(encounter, species) ⇒ Object
-
#pbFindPhoneTrainer(trtype, trname) ⇒ Object
Ignores whether visible or not.
-
#pbFindScript(a, name) ⇒ Object
Constantes definidas en un script ===============================================================================.
-
#pbFishing(hasencounter, rodtype = 1) ⇒ Object
-
#pbFishingBegin ⇒ Object
Fishing ===============================================================================.
-
#pbFishingEnd ⇒ Object
-
#pbFixEventUse(event, mapID, mapdata) ⇒ Object
-
#pbFlash(color, frames) ⇒ Object
-
#pbForgetMove(pokemon, moveToLearn) ⇒ Object
-
#pbGenerateBattleTrainer(trainerid, rule) ⇒ Object
-
#pbGenerateChallenge(rule, tag) {|_INTL("Preparándose para generar equipos")| ... } ⇒ Object
-
#pbGenerateMoveRoute(commands) ⇒ Object
Generación y modificación de los eventos ===============================================================================.
-
#pbGenerateWildPokemon(species, level, isroamer = false) ⇒ Object
-
#pbGetAbbrevMonthName(month) ⇒ Object
-
#pbGetAbilityConst(i) ⇒ Object
-
#pbGetAnimation(name, hue = 0) ⇒ Object
-
#pbGetAutotile(name, hue = 0) ⇒ Object
-
#pbGetBabySpecies(species, item1 = -1,, item2 = -1)) ⇒ Object
-
#pbGetBallType(ball) ⇒ Object
-
#pbGetBasicMapNameFromId(id) ⇒ Object
-
#pbGetBTPokemon(challengeID) ⇒ Object
-
#pbGetBTTrainers(challengeID) ⇒ Object
-
#pbGetColorConst(i) ⇒ Object
-
#pbGetConst(mod, item, err) ⇒ Object
Enum const manipulators and parsers ===============================================================================.
-
#pbGetCsvRecord(rec, lineno, schema) ⇒ Object
Lectura/escritura de registros csv ===============================================================================.
-
#pbGetDependency(eventName) ⇒ Object
Gets the Game_Character object associated with a dependent event.
-
#pbGetEggGroupConst(i) ⇒ Object
-
#pbGetEnvironment ⇒ Object
-
#pbGetEvolutionConst(i) ⇒ Object
-
#pbGetEvolvedFormData(species) ⇒ Object
Funciones de ayuda a la evolución ===============================================================================.
-
#pbGetExceptionMessage(e, script = "") ⇒ Object
-
#pbGetFileChar(file) ⇒ Object
Gets at least the first byte of a file.
-
#pbGetFileString(file) ⇒ Object
Gets the contents of a file.
-
#pbGetFreeTrainerParty(trainerid, trainername) ⇒ Object
-
#pbGetGoldString ⇒ Object
-
#pbGetItemConst(i) ⇒ Object
-
#pbGetLegalMoves(species) ⇒ Object
-
#pbGetLegalMoves2(species, maxlevel) ⇒ Object
-
#pbGetMapNameFromId(id) ⇒ Object
-
#pbGetMessage(type, id) ⇒ Object
-
#pbGetMessageCount(type) ⇒ Object
-
#pbGetMessageFromHash(type, id) ⇒ Object
-
#pbGetMetadata(mapid, metadataType) ⇒ Object
-
#pbGetMinimumLevel(species) ⇒ Object
-
#pbGetMoveConst(i) ⇒ Object
-
#pbGetPlayerCharset(meta, charset, trainer = nil) ⇒ Object
This method causes a lot of lag when the game is encrypted.
-
#pbGetPocket(item) ⇒ Object
-
#pbGetPreviousForm(species) ⇒ Object
-
#pbGetPrice(item) ⇒ Object
-
#pbGetRelearnableMoves(pokemon) ⇒ Object
-
#pbGetSeason ⇒ Object
Estaciones ===============================================================================.
-
#pbGetSeasonName(season) ⇒ Object
-
#pbGetSpeciesConst(i) ⇒ Object
-
#pbGetTerrainTag(event = nil, countBridge = false) ⇒ Object
-
#pbGetText(infile) ⇒ Object
-
#pbGetTileBitmap(filename, tile_id, hue) ⇒ Object
-
#pbGetTileset(name, hue = 0) ⇒ Object
-
#pbGetTimeNow ⇒ Object
Sistema de día y noche ===============================================================================.
-
#pbGetTrainerConst(i) ⇒ Object
-
#pbGetTypeConst(i) ⇒ Object
-
#pbGiveTriadCard(species, quantity = 1) ⇒ Object
-
#pbHallOfFameEntry ⇒ Object
-
#pbHallOfFamePC ⇒ Object
-
#pbHasEligible?(*arg) ⇒ Boolean
Pokémon Organized Battle ===============================================================================.
-
#pbHasPhoneTrainer?(trtype, trname) ⇒ Boolean
-
#pbHasPurifiableInParty ⇒ Object
-
#pbHasRelearnableMove?(pokemon) ⇒ Boolean
-
#pbHatch(pokemon) ⇒ Object
-
#pbHatchAnimation(pokemon) ⇒ Object
-
#pbHelpWindow ⇒ Object
-
#pbHiddenMoveAnimation(pokemon) ⇒ Object
Animación de los movimientos ocultos ===============================================================================.
-
#pbHiddenPower(iv) ⇒ Object
-
#pbHPItem(pokemon, restorehp, scene) ⇒ Object
-
#pbHttpRequest(host, request, filename = nil, depth = 0) ⇒ Object
-
#pbImportAnim(animations, canvas, animwin) ⇒ Object
-
#pbImportNewMaps ⇒ Object
Se agregan los archivos de mapas nuevos al árbol de mapas ===============================================================================.
-
#pbInBugContest? ⇒ Boolean
Returns true if the Bug Catching Contest in progress.
-
#pbInSafari? ⇒ Boolean
-
#pbIsAutumn ⇒ Object
-
#pbIsBanned?(pokemon) ⇒ Boolean
-
#pbIsBerry?(item) ⇒ Boolean
-
#pbIsDitto?(pokemon) ⇒ Boolean
-
#pbIsEvolutionStone?(item) ⇒ Boolean
-
#pbIsFaded? ⇒ Boolean
-
#pbIsFall ⇒ Object
-
#pbIsGem?(item) ⇒ Boolean
-
#pbIsHiddenMachine?(item) ⇒ Boolean
-
#pbIsHiddenMove?(move) ⇒ Boolean
-
#pbIsImportantItem?(item) ⇒ Boolean
Los objetos importantes no se pueden vender, dar o tirar.
-
#pbIsKeyItem?(item) ⇒ Boolean
-
#pbIsMachine?(item) ⇒ Boolean
-
#pbIsMail?(item) ⇒ Boolean
-
#pbIsMegaStone?(item) ⇒ Boolean
Does NOT include Red Orb/Blue Orb.
-
#pbIsMonth(monVariable, *arg) ⇒ Object
Meses ===============================================================================.
-
#pbIsMulch?(item) ⇒ Boolean
-
#pbIsOldSpecialType?(type) ⇒ Boolean
-
#pbIsPokeBall?(item) ⇒ Boolean
-
#pbIsPurifiable?(pkmn) ⇒ Boolean
-
#pbIsSeason(seasonVariable, *arg) ⇒ Object
-
#pbIsSnagBall?(item) ⇒ Boolean
-
#pbIsSpring ⇒ Object
-
#pbIsSummer ⇒ Object
-
#pbIsTechnicalMachine?(item) ⇒ Boolean
-
#pbIsWeekday(wdayVariable, *arg) ⇒ Object
Días de la semana ===============================================================================.
-
#pbIsWinter ⇒ Object
-
#pbItemRestoreHP(pokemon, restorehp) ⇒ Object
-
#pbJustRaiseEffortValues(pokemon, ev, evgain) ⇒ Object
-
#pbLearnMove(pokemon, move, ignoreifknown = false, bymachine = false, &block) ⇒ Object
-
#pbLedge(xOffset, yOffset) ⇒ Object
Field movement ===============================================================================.
-
#pbListScreen(title, lister) ⇒ Object
-
#pbListScreenBlock(title, lister) ⇒ Object
-
#pbListWindow(cmds, width = 256) ⇒ Object
-
#pbLittleCupRules(double) ⇒ Object
-
#pbLoadMessages(file) ⇒ Object
-
#pbLoadMetadata ⇒ Object
-
#pbLoadPhoneData ⇒ Object
-
#pbLoadRxData(file) ⇒ Object
-
#pbLoadTrainer(trainerid, trainername, partyid = 0) ⇒ Object
-
#pbLoadTrainerData(trainerid, trainername, partyid = 0) ⇒ Object
-
#pbLottery(winnum, nameVar = 2, positionVar = 3, matchedVar = 4) ⇒ Object
-
#pbManageMysteryGifts ⇒ Object
Debug option for managing gifts in the Master file and exporting them to a file to be uploaded.
-
#pbMapInterpreter ⇒ Object
-
#pbMapInterpreterRunning? ⇒ Boolean
-
#pbMapTree ⇒ Object
-
#pbMEFade(x = 0.0) ⇒ Object
Fades out or stops ME playback.
-
#pbMEPlay(param, volume = nil, pitch = nil) ⇒ Object
-
#pbMessageWaitForInput(msgwindow, frames, showPause = false) ⇒ Object
-
#pbMEStop(timeInSeconds = 0.0) ⇒ Object
Fades out or stops ME playback.
-
#pbMetadataScreen(defaultMapId = nil) ⇒ Object
-
#pbMiniCheckEvolution(pokemon, evonib, level, poke) ⇒ Object
Métodos de evolución ===============================================================================.
-
#pbMiniCheckEvolutionItem(pokemon, evonib, level, poke, item) ⇒ Object
-
#pbMiningGame ⇒ Object
-
#pbMissingTrainer(trainerid, trainername, trainerparty) ⇒ Object
-
#pbMoveRoute(event, commands, waitComplete = false) ⇒ Object
-
#pbMoveToMailbox(pokemon) ⇒ Object
-
#pbMysteryGiftDecrypt(gift) ⇒ Object
-
#pbMysteryGiftEncrypt(gift) ⇒ Object
Converts an array of gifts into a string and back.
-
#pbNarrowFontName ⇒ Object
Gets the name of the system narrow font.
-
#pbNewBattleScene ⇒ Object
-
#pbNewEncounterType(enc) ⇒ Object
-
#pbNewTrainer(trainerid, trainername, trainerparty) ⇒ Object
-
#pbNextMysteryGiftID ⇒ Object
Collecting a Mystery Gift from the deliveryman.
-
#pbOpenDexData ⇒ Object
-
#pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin) ⇒ Object
-
#pbPCItemStorage ⇒ Object
-
#pbPCMailbox ⇒ Object
-
#pbPhoneBattleCount(trtype, trname) ⇒ Object
-
#pbPhoneCall(call, phonenum) ⇒ Object
-
#pbPhoneDeleteContact(index) ⇒ Object
-
#pbPhoneGenerateCall(phonenum) ⇒ Object
-
#pbPhoneIncrement(trtype, trname, maxbattles) ⇒ Object
-
#pbPhoneReadyToBattle?(trtype, trname) ⇒ Boolean
-
#pbPhoneRegister(event, trainertype, trainername) ⇒ Object
-
#pbPhoneRegisterBattle(message, event, trainertype, trainername, maxbattles) ⇒ Object
-
#pbPhoneRegisterNPC(ident, name, mapid, showmessage = true) ⇒ Object
-
#pbPhoneReset(trtype, trname) ⇒ Object
-
#pbPickBerry(berry, qty = 1) ⇒ Object
-
#pbPikaCupRules(double) ⇒ Object
-
#pbPlayBattle(battledata) ⇒ Object
-
#pbPlayBattleFromFile(filename) ⇒ Object
-
#pbPlayBuzzerSE ⇒ Object
Plays a buzzer sound effect.
-
#pbPlayCancelSE ⇒ Object
Plays a sound effect that plays when a choice is canceled.
-
#pbPlayCursorSE ⇒ Object
Plays a sound effect that plays when the player moves the cursor.
-
#pbPlayDecisionSE ⇒ Object
Plays a sound effect that plays when a decision is confirmed or a choice is made.
-
#pbPlayLastBattle ⇒ Object
-
#pbPocketNames ⇒ Object
* Los nombres de cada uno de los bolsillos de la Mochila.
-
#pbPokeCenterPC ⇒ Object
-
#pbPokeCupRules(double) ⇒ Object
-
#pbPokemonMart(stock, speech = nil, cantsell = false) ⇒ Object
-
#pbPokemonString(pkmn) ⇒ Object
-
#pbPokeRadarCancel ⇒ Object
-
#pbPokeRadarGetEncounter(rarity = 0) ⇒ Object
-
#pbPokeRadarGetShakingGrass ⇒ Object
-
#pbPokeRadarHighlightGrass(showmessage = true) ⇒ Object
-
#pbPokeRadarOnShakingGrass ⇒ Object
-
#pbPopFade ⇒ Object
-
#pbPositionFaceWindow(facewindow, msgwindow) ⇒ Object
-
#pbPositionNearMsgWindow(cmdwindow, msgwindow, side) ⇒ Object
-
#pbPositionPokemonSprite(sprite, left, top) ⇒ Object
-
#pbPostData(url, postdata, filename = nil, depth = 0) ⇒ Object
-
#pbPostToFile(url, postdata, file) ⇒ Object
-
#pbPostToString(url, postdata) ⇒ Object
-
#pbPrepareBattle(battle) ⇒ Object
-
#pbPrimeCupRules(double) ⇒ Object
-
#pbPrintException(e) ⇒ Object
-
#pbPropertyList(title, data, properties, saveprompt = false) ⇒ Object
Core property editor script.
-
#pbPurify(pokemon, scene) ⇒ Object
-
#pbPurifyChamber ⇒ Object
-
#pbPushBranch(list, script, indent = 0) ⇒ Object
-
#pbPushBranchEnd(list, indent = 0) ⇒ Object
-
#pbPushComment(list, cmt, indent = 0) ⇒ Object
-
#pbPushElse(list, indent = 0) ⇒ Object
-
#pbPushEnd(list) ⇒ Object
-
#pbPushEvent(list, cmd, params = nil, indent = 0) ⇒ Object
-
#pbPushExit(list, indent = 0) ⇒ Object
-
#pbPushFade ⇒ Object
-
#pbPushMoveRoute(list, character, route, indent = 0) ⇒ Object
-
#pbPushMoveRouteAndWait(list, character, route, indent = 0) ⇒ Object
-
#pbPushScript(list, script, indent = 0) ⇒ Object
-
#pbPushSelfSwitch(list, swtch, switchOn, indent = 0) ⇒ Object
-
#pbPushText(list, text, indent = 0) ⇒ Object
-
#pbPushWait(list, frames, indent = 0) ⇒ Object
-
#pbRaiseEffortValues(pokemon, ev, evgain = 10, evlimit = true) ⇒ Object
-
#pbRaiseHappinessAndLowerEV(pokemon, scene, ev, messages) ⇒ Object
-
#pbRaiseHappinessAndReduceHeart(pokemon, scene, amount) ⇒ Object
-
#pbRandomEncounterSpecies(enctype) ⇒ Object
-
#pbRandomMove ⇒ Object
-
#pbRandomPhoneItem(array) ⇒ Object
-
#pbRandomPhoneTrainer ⇒ Object
-
#pbRandomPokemonFromRule(rule, trainer) ⇒ Object
-
#pbRandomRoam(index) ⇒ Object
Puts a roamer in a completely random map available to it.
-
#pbRandomRoomTile(dungeon, tiles) ⇒ Object
-
#pbReadyToPurify(pokemon) ⇒ Object
-
#pbReceiveMysteryGift(id) ⇒ Object
-
#pbRecord(text, maxtime = 30.0) ⇒ Object
Voice recorder ===============================================================================.
-
#pbRecordLastBattle ⇒ Object
-
#pbRefreshMGCommands(master, online) ⇒ Object
-
#pbRefreshSceneMap ⇒ Object
-
#pbRegisterPartner(trainerid, trainername, partyid = 0) ⇒ Object
Partner trainer ===============================================================================.
-
#pbRelearnMoveScreen(pokemon) ⇒ Object
-
#pbRelicStone ⇒ Object
-
#pbRelicStoneScreen(pkmn) ⇒ Object
-
#pbRemoveDependencies ⇒ Object
-
#pbRemoveDependency(event) ⇒ Object
-
#pbRemoveDependency2(eventName) ⇒ Object
-
#pbRemoveDuplicates(party) ⇒ Object
-
#pbRepel(item, steps) ⇒ Object
UseFromBag handlers Valores de retorno: 0 = no usado 1 = usado, objeto no consumido 2 = cierra la mochila para usarlo, objeto no consumido 3 = usado, objeto consumido 4 = cierra la mochila para usarlo, objeto consumido ===============================================================================.
-
#pbReplaceMoves(pokemon, move1, move2 = 0, move3 = 0, move4 = 0) ⇒ Object
-
#pbReplenishBattlePokemon(party, rule) ⇒ Object
-
#pbRepositionMessageWindow(msgwindow, linecount = 2) ⇒ Object
-
#pbResetAllRoamers ⇒ Object
Resets all roaming Pokemon that were defeated without having been caught.
-
#pbResetCel(frame) ⇒ Object
-
#pbResolveAudioFile(str, volume = nil, pitch = nil) ⇒ Object
Converts an object to an audio file.
-
#pbResolveBitmap(x) ⇒ Object
Finds the real path for an image file.
-
#pbRestoreActivations(sprites, activeStatuses) ⇒ Object
Restores which windows are active for the given sprite hash.
-
#pbRestorePP(pokemon, move, pp) ⇒ Object
-
#pbRestoreSpriteState(sprite, state) ⇒ Object
-
#pbRestoreSpriteStateAndBitmap(sprite, state) ⇒ Object
-
#pbRgssChdir(dir) ⇒ Object
-
#pbRgssExists?(filename) ⇒ Boolean
Used to determine whether a data file exists (rather than a graphics or audio file).
-
#pbRgssOpen(file, mode = nil) ⇒ Object
Opens an IO, even if the file is in an encrypted archive.
-
#pbRoamingAreas(index) ⇒ Object
Gets the roaming areas for a particular Pokémon.
-
#pbRoamingMethodAllowed(enctype) ⇒ Object
-
#pbRoamingPokemonBattle(species, level) ⇒ Object
-
#pbRoamPokemon(ignoretrail = false) ⇒ Object
Roams all roamers, if their Switch is on.
-
#pbRockSmashRandomEncounter ⇒ Object
Golpe roca / Rock Smash ===============================================================================.
-
#pbRuledBattle(team1, team2, rule) ⇒ Object
-
#pbSafariBattle(species, level) ⇒ Object
-
#pbSafariState ⇒ Object
-
#pbSafeLoad(file) ⇒ Object
Loads data from a file “safely”, similar to load_data.
-
#pbSameThread(wnd) ⇒ Object
-
#pbSave(safesave = false) ⇒ Object
-
#pbSaveAbilities ⇒ Object
-
#pbSaveAllData ⇒ Object
-
#pbSaveBattlePokemon(btpokemon, filename) ⇒ Object
-
#pbSaveBTTrainers(bttrainers, filename) ⇒ Object
-
#pbSaveConnectionData ⇒ Object
-
#pbSaveEncounterData ⇒ Object
-
#pbSaveItems ⇒ Object
-
#pbSaveMachines ⇒ Object
-
#pbSaveMetadata ⇒ Object
-
#pbSaveMoveData ⇒ Object
-
#pbSavePhoneData ⇒ Object
-
#pbSavePokemonData ⇒ Object
-
#pbSaveShadowMoves ⇒ Object
-
#pbSaveSpriteState(sprite) ⇒ Object
-
#pbSaveSpriteStateAndBitmap(sprite) ⇒ Object
-
#pbSaveTownMap ⇒ Object
-
#pbSaveTrainerBattles ⇒ Object
-
#pbSaveTrainerLists ⇒ Object
-
#pbSaveTrainerTypes ⇒ Object
-
#pbSaveTypes ⇒ Object
-
#pbSceneStandby ⇒ Object
-
#pbScreenCapture ⇒ Object
-
#pbScrollMap(direction, distance, speed) ⇒ Object
-
#pbSEFade(x = 0.0) ⇒ Object
-
#pbSelectAnim(canvas, animwin) ⇒ Object
Pop-up menus for buttons in bottom menu.
-
#pbSelectBG(canvas, timing) ⇒ Object
-
#pbSelectSE(canvas, audio) ⇒ Object
-
#pbSellTriads ⇒ Object
-
#pbSEPlay(param, volume = nil, pitch = nil) ⇒ Object
-
#pbSerializeConnectionData(conndata, mapinfos) ⇒ Object
-
#pbSerializeMetadata(metadata, mapinfos) ⇒ Object
-
#pbSEStop(timeInSeconds = 0.0) ⇒ Object
-
#pbSetEscapePoint ⇒ Object
-
#pbSetFlash(cel, previewsprite) ⇒ Object
-
#pbSetLotteryNumber(variable = 1) ⇒ Object
“Lottery” mini-game By Maruno.
-
#pbSetNarrowFont(bitmap) ⇒ Object
Sets a bitmap's font to the system narrow font.
-
#pbSetReadyToBattle(num) ⇒ Object
-
#pbSetResizeFactor(factor = 1, norecalc = false) ⇒ Object
-
#pbSetResizeFactor2(factor, force = false) ⇒ Object
-
#pbSetSmallFont(bitmap) ⇒ Object
Sets a bitmap's font to the system small font.
-
#pbSetSpritesToColor(sprites, color) ⇒ Object
-
#pbSetSystemFont(bitmap) ⇒ Object
Sets a bitmap's font to the system font.
-
#pbSetTextMessages ⇒ Object
-
#pbSettingToTextSpeed(speed) ⇒ Object
-
#pbSetTone(cel, previewsprite) ⇒ Object
-
#pbSetUpSystem ⇒ Object
-
#pbShake(power, speed, frames) ⇒ Object
-
#pbShowMap(region = -1,, wallmap = true) ⇒ Object
-
#pbSlotMachine(difficulty = 1) ⇒ Object
-
#pbSmallFontName ⇒ Object
Gets the name of the system small font.
-
#pbSpeciesCompatible?(species, move) ⇒ Boolean
-
#pbSpriteHitTest(sprite, x, y, usealpha = true, wholecanvas = false) ⇒ Object
-
#pbSpriteSetAnimFrame(sprite, frame, user = nil, target = nil, ineditor = false) ⇒ Object
-
#pbSpriteSetCenter(sprite, cx, cy) ⇒ Object
-
#pbSrcOver(dstColor, srcColor) ⇒ Object
-
#pbStartSurfing ⇒ Object
-
#pbStartsWith(s, pfx) ⇒ Object
-
#pbStartTrade(pokemonIndex, newpoke, nickname, trainerName, trainerGender = 0) ⇒ Object
-
#pbStorageCreator ⇒ Object
* El nombre del creador del Sistema de Almacenamiento de Pokémon.
-
#pbStoreMail(pkmn, item, message, poke1 = nil, poke2 = nil, poke3 = nil) ⇒ Object
-
#pbStrictLittleCupRules(double) ⇒ Object
-
#pbStringToAudioFile(str) ⇒ Object
-
#pbSweetScent ⇒ Object
Dulce Aroma / Sweet Scent ===============================================================================.
-
#pbTestPass(follower, x, y, direction = nil) ⇒ Object
-
#pbTextBitmap(text, maxwidth = Graphics.width) ⇒ Object
-
#pbTilePuzzle(game, board, width = 0, height = 0) ⇒ Object
-
#pbTimingList(canvas) ⇒ Object
Pop-up menus for buttons in right hand menu.
-
#pbTMRS ⇒ Object
Compilación de las compatibilidades de MT/MO/Tutor de Movimientos ===============================================================================.
-
#pbToneChangeAll(tone, duration) ⇒ Object
Screen effects ===============================================================================.
-
#pbTooHeavy?(pokemon, maxWeightInKg) ⇒ Boolean
-
#pbTooTall?(pokemon, maxHeightInMeters) ⇒ Boolean
-
#pbTopRightWindow(text) ⇒ Object
-
#pbTrackPopupMenu(commands) ⇒ Object
-
#pbTradeCheckEvolution(pokemon, pokemon2) ⇒ Object
Evolution methods ===============================================================================.
-
#pbTrainerBattle(trainerid, trainername, endspeech, doublebattle = false, trainerparty = 0, canlose = false, variable = nil) ⇒ Object
-
#pbTrainerBattleEditor ⇒ Object
-
#pbTrainerCheck(trainerid, trainername, maxbattles, startBattleId = 0) ⇒ Object
-
#pbTrainerInfo(pokemonlist, trfile, rules) {|nil| ... } ⇒ Object
-
#pbTrainerMapName(phonenum) ⇒ Object
-
#pbTrainerPC ⇒ Object
-
#pbTrainerPCMenu ⇒ Object
-
#pbTrainerSpecies(phonenum) ⇒ Object
-
#pbTrainerTypeCheck(symbol) ⇒ Object
-
#pbTrainerTypeEditor ⇒ Object
-
#pbTrainerTypeEditorNew(trconst) ⇒ Object
Trainer type editor / Editor de tipo de entrenador.
-
#pbTrainerTypeEditorSave(trainertype, ttdata) ⇒ Object
-
#pbTriadDuel(name, minLevel, maxLevel, rules = nil, oppdeck = nil, prize = nil) ⇒ Object
-
#pbTriadList ⇒ Object
-
#pbTryString(x) ⇒ Object
-
#pbTurnTowardEvent(event, otherEvent) ⇒ Object
Event movement ===============================================================================.
-
#pbTweening(canvas) ⇒ Object
-
#pbUpdateDoor(event, mapdata) ⇒ Object
-
#pbUpdateMsgWindowPos(msgwindow, event, eventChanged = false) ⇒ Object
-
#pbUpdateSceneMap ⇒ Object
-
#pbUpdateSpriteHash(windows) ⇒ Object
-
#pbUseItem(bag, item, bagscene = nil) ⇒ Object
-
#pbUseItemOnPokemon(item, pokemon, scene) ⇒ Object
Only called when in the party screen and having chosen an item to be used on the selected Pokémon.
-
#pbUseKeyItem ⇒ Object
-
#pbUsePokeRadar ⇒ Object
-
#pbVoltorbFlip ⇒ Object
-
#pbWait(numframes) ⇒ Object
-
#pbWaitForInput(msgwindow, message, frames) ⇒ Object
-
#pbWaitMessage(msgwindow, time) ⇒ Object
-
#pbWarpToMap ⇒ Object
-
#pbWildBattle(species, level, variable = nil, canescape = true, canlose = false) ⇒ Object
-
#pbWriteCsvRecord(record, file, schema) ⇒ Object
-
#pbWriteCup(id, rules) ⇒ Object
-
#pbWriteDefaultTypes ⇒ Object
Compilación de tipos ===============================================================================.
-
#pokeballThrow(ball, shakes, critical, targetBattler, scene, battler, burst = -1,, showplayer = false) ⇒ Object
Shows the player's Poké Ball being thrown to capture a Pokémon.
-
#prepline(line) ⇒ Object
-
#readItemList(filename) ⇒ Object
-
#readSerialRecords(filename) ⇒ Object
-
#removeConstantValue(mod, value) ⇒ Object
-
#renderLineBrokenChunks(bitmap, xDst, yDst, normtext, maxheight = 0) ⇒ Object
-
#renderLineBrokenChunksWithShadow(bitmap, xDst, yDst, normtext, maxheight, baseColor, shadowColor) ⇒ Object
-
#renderMultiLine(bitmap, xDst, yDst, normtext, maxheight, baseColor, shadowColor) ⇒ Object
-
#repositionY(x1, y1, x2, y2, tx, ty) ⇒ Object
-
#Rgb16ToColor(param) ⇒ Object
-
#rgbToColor(param) ⇒ Object
-
#safeExists?(f) ⇒ Boolean
Works around a problem with FileTest.exist if path contains accent marks.
-
#safeGlob(dir, wildcard) ⇒ Object
Similar to “Dir.glob”, but designed to work around a problem with accessing files if a path contains accent marks.
-
#safeIsDirectory?(f) ⇒ Boolean
Works around a problem with FileTest.directory if directory contains accent marks.
-
#safequote(x) ⇒ Object
-
#safequote2(x) ⇒ Object
-
#setConstantName(mod, value, name) ⇒ Object
-
#setPictureIconSprite(sprite, picture) ⇒ Object
-
#setPictureSprite(sprite, picture) ⇒ Object
-
#setScreenBorderName(border) ⇒ Object
-
#shadowc3tag(base, shadow) ⇒ Object
-
#shadowctag(base, shadow) ⇒ Object
-
#shadowctagFromColor(color) ⇒ Object
-
#shadowctagFromRgb(param) ⇒ Object
-
#showShadow?(species) ⇒ Boolean
-
#strSize(str) ⇒ Object
-
#strsplit(str, re) ⇒ Object
-
#toUnformattedText(text) ⇒ Object
-
#transformPoint(x1, y1, x2, y2, x3, y3, x4, y4, px, py) ⇒ Object
-
#tryLoadData(file) ⇒ Object
-
#unformattedTextLength(text) ⇒ Object
-
#updateTilesets ⇒ Object
-
#using(window) ⇒ Object
-
#withRestr(rule, minbs, maxbs, legendary) ⇒ Object
-
#writeConnectionPoint(map1, x1, y1, map2, x2, y2) ⇒ Object
-
#writeSerialRecords(filename, records) ⇒ Object
-
#XPML_read(map, markup, event, max_param_number = 0) ⇒ Object
? XPML Definition, by Rataime, using ideas from Near Fantastica.
-
#yaxisIntersect(x1, y1, x2, y2, px, py) ⇒ Object
-
#zodiac(month, day) ⇒ Object
Calculates the zodiac sign based on the given month and day: 0 is Aries, 11 is Pisces.
-
#zodiacComplements(sign) ⇒ Object
0 is Aries, 11 is Pisces.
-
#zodiacOpposite(sign) ⇒ Object
Returns the opposite of the given zodiac sign.
-
#zodiacPartners(sign) ⇒ Object
0 is Aries, 11 is Pisces.
Instance Method Details
#_I(str) ⇒ Object
747
748
749
|
# File 'scripts/Intl_Messages.rb', line 747
def _I(str)
return _MAPINTL($game_map.map_id,str)
end
|
#_INTL(*arg) ⇒ Object
Replaces first argument with a localized version and formats the other parameters by replacing 1, 2, etc. with those placeholders.
716
717
718
719
720
721
722
|
# File 'scripts/Intl_Messages.rb', line 716
def _INTL(*args);
string=args[0].clone
for i in 1...args.length
string.gsub!(/\{#{i}\}/,"#{args[i]}")
end
return string
end
|
#_ISPRINTF(*arg) ⇒ Object
Replaces first argument with a localized version and formats the other parameters by replacing 1, 2, etc. with those placeholders. This version acts more like sprintf, supports e.g. 1:d or 2:s
732
733
734
735
736
737
738
739
740
|
# File 'scripts/Intl_Messages.rb', line 732
def _ISPRINTF(*args);
string=args[0].clone
for i in 1...args.length
string.gsub!(/\{#{i}\:([^\}]+?)\}/){|m|
next sprintf("%"+$1,args[i])
}
end
return string
end
|
#_MAPINTL(mapid, *arg) ⇒ Object
290
291
292
293
294
295
296
|
# File 'scripts/SpriteWindow.rb', line 290
def _MAPINTL(*args);
string=args[1].clone
for i in 2...args.length
string.gsub!(/\{#{i}\}/,"#{args[i+1]}")
end
return string
end
|
#_MAPISPRINTF(mapid, *arg) ⇒ Object
760
761
762
763
764
765
766
767
768
769
|
# File 'scripts/Intl_Messages.rb', line 760
def _MAPISPRINTF(mapid,*arg)
string=MessageTypes.getFromMapHash(mapid,arg[0])
string=string.clone
for i in 1...arg.length
string.gsub!(/\{#{i}\:([^\}]+?)\}/){|m|
next sprintf("%"+$1,arg[i])
}
end
return string
end
|
#addBackgroundOrColoredPlane(sprites, planename, background, color, viewport = nil) ⇒ Object
Adds a background to the sprite hash. planename is the hash key of the background. background is a filename within the Graphics/Pictures/ folder and can be
an animated image.
color is the color to use if the background can't be found. viewport is a viewport to place the background in.
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
|
# File 'scripts/SpriteWindow.rb', line 1443
def addBackgroundOrColoredPlane(sprites,planename,background,color,viewport=nil)
bitmapName=pbResolveBitmap("Graphics/Pictures/#{background}")
if bitmapName==nil
sprites[planename]=ColoredPlane.new(color,@viewport)
else
sprites[planename]=AnimatedPlane.new(viewport)
sprites[planename].setBitmap(bitmapName)
for spr in sprites.values
if spr.is_a?(Window)
spr.windowskin=nil
end
end
end
end
|
#addBackgroundPlane(sprites, planename, background, viewport = nil) ⇒ Object
Adds a background to the sprite hash. planename is the hash key of the background. background is a filename within the Graphics/Pictures/ folder and can be
an animated image.
viewport is a viewport to place the background in.
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
|
# File 'scripts/SpriteWindow.rb', line 1420
def addBackgroundPlane(sprites,planename,background,viewport=nil)
sprites[planename]=AnimatedPlane.new(viewport)
bitmapName=pbResolveBitmap("Graphics/Pictures/#{background}")
if bitmapName==nil
sprites[planename].bitmap=nil
sprites[planename].visible=false
else
sprites[planename].setBitmap(bitmapName)
for spr in sprites.values
if spr.is_a?(Window)
spr.windowskin=nil
end
end
end
end
|
#addMove(moves, move, base) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 13
def addMove(moves,move,base)
data=moveData(move)
count=base+1
if data.function==0 && data.basedamage<=40
count=base
end
if isConst?(move,PBMoves,:BUBBLE) ||
isConst?(move,PBMoves,:BUBBLEBEAM)
count=0
return
end
if data.basedamage<=30 ||
isConst?(move,PBMoves,:GROWL) ||
isConst?(move,PBMoves,:TAILWHIP) ||
isConst?(move,PBMoves,:LEER)
count=base
end
if data.basedamage>=60 ||
isConst?(move,PBMoves,:REFLECT)||
isConst?(move,PBMoves,:LIGHTSCREEN) ||
isConst?(move,PBMoves,:SAFEGUARD) ||
isConst?(move,PBMoves,:SUBSTITUTE) ||
isConst?(move,PBMoves,:FAKEOUT)
count=base+2
end
if data.basedamage>=80 && isConst?(data.type,PBTypes,:NORMAL)
count=base+5
end
if data.basedamage>=80 && isConst?(data.type,PBTypes,:NORMAL)
count=base+3
end
if isConst?(move,PBMoves,:PROTECT) ||
isConst?(move,PBMoves,:DETECT) ||
isConst?(move,PBMoves,:TOXIC) ||
isConst?(move,PBMoves,:AERIALACE) ||
isConst?(move,PBMoves,:WILLOWISP) ||
isConst?(move,PBMoves,:SPORE) ||
isConst?(move,PBMoves,:THUNDERWAVE) ||
isConst?(move,PBMoves,:HYPNOSIS) ||
isConst?(move,PBMoves,:CONFUSERAY) ||
isConst?(move,PBMoves,:ENDURE) ||
isConst?(move,PBMoves,:SWORDSDANCE)
count=base+3
end
if !moves.include?(move)
count.times{moves.push(move)}
end
end
|
#adjustBattleSpriteY(sprite, species, index, metrics = nil) ⇒ Object
374
375
376
377
378
379
380
381
|
# File 'scripts/Pokemon_Sprites.rb', line 374
def adjustBattleSpriteY(sprite,species,index,metrics=nil)
ret=0
spriteheight=(sprite.bitmap &&
!sprite.bitmap.disposed?) ? sprite.bitmap.height : 128
ret-=spriteheight
ret+=getBattleSpriteMetricOffset(species,index,metrics)
return ret
end
|
#animationEditorMain(animation) ⇒ Object
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
|
# File 'scripts/BattleAnimationEditor.rb', line 3506
def animationEditorMain(animation)
viewport=Viewport.new(0,0,512+288,384+288)
viewport.z=99999
canvas=AnimationCanvas.new(animation[animation.selected],viewport)
sidewin=ControlWindow.new(512+128,0,160,384+128)
sidewin.addButton(_INTL("SE and BG..."))
sidewin.addButton(_INTL("Cel Focus..."))
sidewin.addSpace
sidewin.addButton(_INTL("Paste Last"))
sidewin.addButton(_INTL("Copy Frames..."))
sidewin.addButton(_INTL("Clear Frames..."))
sidewin.addButton(_INTL("Tweening..."))
sidewin.addButton(_INTL("Cel Batch..."))
sidewin.addButton(_INTL("Entire Slide..."))
sidewin.addSpace
sidewin.addButton(_INTL("Play Animation"))
sidewin.addButton(_INTL("Play Opp Anim"))
sidewin.addButton(_INTL("Import Anim..."))
sidewin.addButton(_INTL("Export Anim..."))
sidewin.addButton(_INTL("Help"))
sidewin.viewport=canvas.viewport
sliderwin=ControlWindow.new(0,384+128,240,160)
sliderwin.addControl(FrameCountSlider.new(canvas))
sliderwin.addControl(FrameCountButton.new(canvas))
sliderwin.addButton(_INTL("Set Animation Sheet"))
sliderwin.addButton(_INTL("List of Animations"))
sliderwin.viewport=canvas.viewport
animwin=CanvasAnimationWindow.new(canvas,240,384+128,512,96,canvas.viewport)
bottomwindow=AnimationNameWindow.new(canvas,240,384+128+96,512,64,canvas.viewport)
loop do
Graphics.update
Input.update
sliderwin.update
canvas.update
sidewin.update
animwin.update
bottomwindow.update
if animwin.changed?
canvas.pattern=animwin.selected
end
if Input.trigger?(Input::B)
if Kernel.pbConfirmMessage(_INTL("Save changes?"))
save_data(animation,"Data/PkmnAnimations.rxdata")
end
if Kernel.pbConfirmMessage(_INTL("Exit from the editor?"))
break
end
end
if Input.trigger?(Input::F5)
pbHelpWindow
next
elsif Input.triggerex?(Input::RightMouseKey) && sliderwin.hittest?(0) commands=[
_INTL("Copy Frame"),
_INTL("Paste Frame"),
_INTL("Clear Frame"),
_INTL("Insert Frame"),
_INTL("Delete Frame")
]
hit=(commands)
case hit
when 0 if canvas.currentframe>=0
Clipboard.setData(canvas.animation[canvas.currentframe],"PBAnimFrame")
end
when 1 if canvas.currentframe>=0
canvas.pasteFrame(canvas.currentframe)
end
when 2 canvas.clearFrame(canvas.currentframe)
when 3 canvas.insertFrame(canvas.currentframe)
sliderwin.invalidate
when 4 canvas.deleteFrame(canvas.currentframe)
sliderwin.controls[0].curvalue=canvas.currentframe+1
sliderwin.invalidate
end
next
elsif Input.triggerex?(0x51) if canvas.currentCel
pbDefinePath(canvas)
sliderwin.invalidate
end
next
elsif Input.triggerex?(Input::RightMouseKey) mousepos=Mouse::getMousePos
mousepos=[0,0] if !mousepos
commands=[
_INTL("Properties..."),
_INTL("Cut"),
_INTL("Copy"),
_INTL("Paste"),
_INTL("Delete"),
_INTL("Renumber..."),
_INTL("Define Path...")
]
hit=(commands)
case hit
when 0 if canvas.currentCel
pbCellProperties(canvas)
canvas.invalidateCel(canvas.currentcel)
end
when 1 if canvas.currentCel
Clipboard.setData(canvas.currentCel,"PBAnimCel")
canvas.deleteCel(canvas.currentcel)
end
when 2 if canvas.currentCel
Clipboard.setData(canvas.currentCel,"PBAnimCel")
end
when 3 canvas.pasteCel(mousepos[0],mousepos[1])
when 4 canvas.deleteCel(canvas.currentcel)
when 5 if canvas.currentcel && canvas.currentcel>=2
cel1=canvas.currentcel
cel2=pbChooseNum(cel1)
if cel2>=2 && cel1!=cel2
canvas.swapCels(cel1,cel2)
end
end
when 6 if canvas.currentCel
pbDefinePath(canvas)
sliderwin.invalidate
end
end
next
end
if sliderwin.changed?(0) canvas.currentframe=sliderwin.value(0)-1
end
if sliderwin.changed?(1) pbChangeMaximum(canvas)
sliderwin.refresh
end
if sliderwin.changed?(2) pbSelectAnim(canvas,animwin)
animwin.refresh
sliderwin.refresh
end
if sliderwin.changed?(3) pbAnimList(animation,canvas,animwin)
sliderwin.controls[0].curvalue=canvas.currentframe+1
bottomwindow.refresh
animwin.refresh
sliderwin.refresh
end
if sidewin.changed?(0)
pbTimingList(canvas)
end
if sidewin.changed?(1)
positions=[_INTL("User"),_INTL("Target"),_INTL("User and target"),_INTL("Screen")]
indexes=[2,1,3,4] for i in 0...positions.length
selected="[ ]"
if animation[animation.selected].position==indexes[i]
selected="[x]"
end
positions[i]=sprintf("%s %s",selected,positions[i])
end
pos=Kernel.pbShowCommands(nil,positions,-1)
if pos>=0
animation[animation.selected].position=indexes[pos]
canvas.update
end
end
if sidewin.changed?(3)
canvas.pasteLast
end
if sidewin.changed?(4)
pbCopyFrames(canvas)
end
if sidewin.changed?(5)
pbClearFrames(canvas)
end
if sidewin.changed?(6)
pbTweening(canvas)
end
if sidewin.changed?(7)
pbCellBatch(canvas)
end
if sidewin.changed?(8)
pbEntireSlide(canvas)
end
if sidewin.changed?(10)
canvas.play
end
if sidewin.changed?(11)
canvas.play(true)
end
if sidewin.changed?(12)
pbImportAnim(animation,canvas,animwin)
sliderwin.controls[0].curvalue=canvas.currentframe+1
bottomwindow.refresh
animwin.refresh
sliderwin.refresh
end
if sidewin.changed?(13)
pbExportAnim(animation)
bottomwindow.refresh
animwin.refresh
sliderwin.refresh
end
if sidewin.changed?(14)
pbHelpWindow
end
end
canvas.dispose
animwin.dispose
sliderwin.dispose
sidewin.dispose
bottomwindow.dispose
viewport.dispose
GC.start
end
|
#applyPages(page, pages) ⇒ Object
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
|
# File 'scripts/Compiler.rb', line 3177
def applyPages(page,pages)
for p in pages
p.graphic=page.graphic
p.walk_anime=page.walk_anime
p.step_anime=page.step_anime
p.direction_fix=page.direction_fix
p.through=page.through
p.always_on_top=page.always_on_top
end
end
|
#at_exit(&block) ⇒ Object
58
59
60
|
# File 'scripts/Audio.rb', line 58
def at_exit(&block)
$AtExitProcs.push(Proc.new(&block))
end
|
#Audio_bgm_fade(ms) ⇒ Object
#Audio_bgm_fadein(ms) ⇒ Object
#Audio_bgm_get_position ⇒ Object
#Audio_bgm_get_volume ⇒ Object
#Audio_bgm_name ⇒ Object
161
162
163
|
# File 'scripts/Audio.rb', line 161
def Audio_bgm_name
AudioState.name
end
|
#Audio_bgm_pitch ⇒ Object
165
166
167
|
# File 'scripts/Audio.rb', line 165
def Audio_bgm_pitch
AudioState.pitch
end
|
#Audio_bgm_play(name, volume, pitch, position = 0) ⇒ Object
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'scripts/Audio.rb', line 169
def Audio_bgm_play(name, volume, pitch, position = 0)
volume=0 if !getPlayMusic()
begin
filename = canonicalize(RTP.getAudioPath(name))
if AudioState.meActive?
AudioState.setWaitingBGM(filename,volume,pitch,position)
return
end
AudioState::AudioContextPlay.call(AudioState.context,filename,volume,pitch,position,1)
AudioState.name=filename
AudioState.volume=volume
AudioState.pitch=pitch
rescue Hangup
rescue
p $!.message,$!.backtrace
end
end
|
#Audio_bgm_playing? ⇒ Boolean
157
158
159
|
# File 'scripts/Audio.rb', line 157
def Audio_bgm_playing?
AudioState.channel!=nil
end
|
#Audio_bgm_set_volume(volume) ⇒ Object
#Audio_bgs_fade(ms) ⇒ Object
#Audio_bgs_play(name, volume, pitch, position = 0) ⇒ Object
249
250
251
252
253
254
255
256
257
258
|
# File 'scripts/Audio.rb', line 249
def Audio_bgs_play(name, volume, pitch, position = 0)
volume=0 if !getPlaySound()
begin
filename = canonicalize(RTP.getAudioPath(name))
AudioState::AudioContextPlay.call(AudioState.bgsContext,filename,
volume,pitch,position,0)
rescue
p $!.message,$!.backtrace
end
end
|
#Audio_me_fade(ms) ⇒ Object
#Audio_me_play(name, volume, pitch, position = 0) ⇒ Object
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
# File 'scripts/Audio.rb', line 220
def Audio_me_play(name, volume, pitch, position = 0)
volume=0 if !getPlayMusic()
begin
filename = canonicalize(RTP.getAudioPath(name))
if AudioState.bgmActive?
bgmPosition=Kernel.Audio_bgm_get_position
AudioState.setWaitingBGM(
AudioState.name,
AudioState.volume,
AudioState.pitch,
bgmPosition
)
AudioState::AudioContextStop.call(AudioState.context)
end
AudioState::AudioContextPlay.call(AudioState.meContext,filename,
volume,pitch,position,0)
rescue
p $!.message,$!.backtrace
end
end
|
#Audio_se_play(name, volume, pitch, position = 0) ⇒ Object
#babySpecies(move) ⇒ Object
160
161
162
163
164
165
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 160
def babySpecies(move)
if !$babySpecies[move]
$babySpecies[move]=pbGetBabySpecies(move)
end
return $babySpecies[move]
end
|
#baseStatTotal(move) ⇒ Object
153
154
155
156
157
158
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 153
def baseStatTotal(move)
if !$baseStatTotal[move]
$baseStatTotal[move]=pbBaseStatTotal(move)
end
return $baseStatTotal[move]
end
|
#bltMinimapAutotile(dstBitmap, x, y, srcBitmap, id) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'scripts/Tilemap_Perspective.rb', line 1
def bltMinimapAutotile(dstBitmap,x,y,srcBitmap,id)
return if id>=48 || !srcBitmap || srcBitmap.disposed?
anim=0
cxTile=3
cyTile=3
tiles = TileDrawingHelper::Autotiles[id>>3][id&7]
src=Rect.new(0,0,0,0)
for i in 0...4
tile_position = tiles[i] - 1
src.set(
tile_position % 6 * cxTile + anim,
tile_position / 6 * cyTile, cxTile, cyTile)
dstBitmap.blt(i%2*cxTile+x,i/2*cyTile+y, srcBitmap, src)
end
end
|
#calcPoint(x, y, distance, angle) ⇒ Object
299
300
301
302
303
304
305
306
307
|
# File 'scripts/PScreen_PurifyChamber.rb', line 299
def calcPoint(x,y,distance,angle) angle -=(angle/360.0).floor*360 angle = (angle/360.0)*(2*Math::PI) angle = -angle % (2*Math::PI) point = [(Math.cos(angle) * distance), (Math.sin(angle) * distance)]
point[0] += x
point[1] += y
return point
end
|
#canonicalize(c) ⇒ Object
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
|
# File 'scripts/Compiler.rb', line 663
def canonicalize(c)
csplit=strsplit(c,/[\/\\]/)
pos=-1
ret=[]
retstr=""
for x in csplit
if x=="."
elsif x==".."
ret.delete_at(pos) if pos>=0
pos-=1
else
ret.push(x)
pos+=1
end
end
for i in 0...ret.length
retstr+="/" if i>0
retstr+=ret[i]
end
return retstr
end
|
#catmullRom(p1, p2, p3, p4, t) ⇒ Object
3154
3155
3156
3157
3158
3159
3160
3161
|
# File 'scripts/BattleAnimationEditor.rb', line 3154
def catmullRom(p1,p2,p3,p4,t)
t2=t*t
t3=t2*t
return 0.5*(2*p2+t*(p3-p1) +
t2*(2*p1-5*p2+4*p3-p4)+
t3*(p4-3*p3+3*p2-p1))
end
|
#checkEnumField(ret, enumer) ⇒ Object
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
# File 'scripts/Compiler.rb', line 440
def checkEnumField(ret,enumer)
if enumer.is_a?(Module)
begin
if ret=="" || !enumer.const_defined?(ret)
raise _INTL("Valor indefinido {1} en {2}\r\n{3}",ret,enumer.name,FileLineData.linereport)
end
rescue NameError
raise _INTL("Valor incorrecto {1} en {2}\r\n{3}",ret,enumer.name,FileLineData.linereport)
end
return enumer.const_get(ret.to_sym)
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
enumer=Object.const_get(enumer.to_sym)
begin
if ret=="" || !enumer.const_defined?(ret)
raise _INTL("Valor indefinido {1} en {2}\r\n{3}",ret,enumer.name,FileLineData.linereport)
end
rescue NameError
raise _INTL("Valor incorrecto {1} en {2}\r\n{3}",ret,enumer.name,FileLineData.linereport)
end
return enumer.const_get(ret.to_sym)
elsif enumer.is_a?(Array)
idx=findIndex(enumer){|item| ret==item}
if idx<0
raise _INTL("Valor indefinido {1} (se esperaba uno de: {2})\r\n{3}",ret,enumer.inspect,FileLineData.linereport)
end
return idx
elsif enumer.is_a?(Hash)
value=enumer[ret]
if value==nil
raise _INTL("Valor incorrecto {1} (se esperaba uno de: {2})\r\n{3}",ret,enumer.keys.inspect,FileLineData.linereport)
end
return value
end
raise _INTL("Enumeración no definida\r\n{1}",FileLineData.linereport)
end
|
#chooseMapPoint(map, rgnmap = false) ⇒ Object
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
|
# File 'scripts/Editor.rb', line 3438
def chooseMapPoint(map,rgnmap=false)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
title=Window_UnformattedTextPokemon.new(_INTL("Pincha un punto en el mapa."))
title.x=0
title.y=Graphics.height-64
title.width=Graphics.width
title.height=64
title.viewport=viewport
title.z=2
if rgnmap
sprite=RegionMapSprite.new(map,viewport)
else
sprite=MapSprite.new(map,viewport)
end
sprite.z=2
ret=nil
loop do
Graphics.update
Input.update
xy=sprite.getXY
if xy
ret=xy
break
end
if Input.trigger?(Input::B)
ret=nil
break
end
end
sprite.dispose
title.dispose
return ret
end
|
#coloredToFormattedText(text, baseColor = nil, shadowColor = nil) ⇒ Object
Deprecated – not to be used in new code
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
|
# File 'scripts/DrawText.rb', line 1116
def coloredToFormattedText(text,baseColor=nil,shadowColor=nil)
base=!baseColor ? Color.new(12*8,12*8,12*8) : baseColor.clone
shadow=!shadowColor ? Color.new(26*8,26*8,25*8) : shadowColor.clone
text2=text.gsub(/&/,"&")
text2.gsub!(/</,"<")
text2.gsub!(/>/,">")
text2.gsub!(/\\\[([A-Fa-f0-9]{8,8})\]/){ "<c2="+$1+">" }
text2="<c2="+colorToRgb16(base)+colorToRgb16(shadow)+">"+text2
text2.gsub!(/\\\\/,"\\")
return text2
end
|
#colorToRgb16(color) ⇒ Object
106
107
108
109
110
111
|
# File 'scripts/DrawText.rb', line 106
def colorToRgb16(color)
ret=(color.red.to_i>>3)
ret|=((color.green.to_i>>3)<<5)
ret|=((color.blue.to_i>>3)<<10)
return sprintf("%04X",ret)
end
|
#colorToRgb32(color) ⇒ Object
95
96
97
98
99
100
101
102
103
104
|
# File 'scripts/DrawText.rb', line 95
def colorToRgb32(color)
return "" if !color
if color.alpha.to_i==255
return sprintf("%02X%02X%02X",color.red.to_i,
color.green.to_i,color.blue.to_i)
else
return sprintf("%02X%02X%02X%02X",color.red.to_i,
color.green.to_i,color.blue.to_i,color.alpha.to_i)
end
end
|
#createMinimap(mapid) ⇒ Object
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
|
# File 'scripts/Editor.rb', line 3413
def createMinimap(mapid)
map=load_data(sprintf("Data/Map%03d.rxdata",mapid)) rescue nil
return BitmapWrapper.new(32,32) if !map
bitmap=BitmapWrapper.new(map.width*4,map.height*4)
black=Color.new(0,0,0)
tilesets=load_data("Data/Tilesets.rxdata")
tileset=tilesets[map.tileset_id]
return bitmap if !tileset
helper=TileDrawingHelper.fromTileset(tileset)
for y in 0...map.height
for x in 0...map.width
for z in 0..2
id=map.data[x,y,z]
id=0 if !id
helper.bltSmallTile(bitmap,x*4,y*4,4,4,id)
end
end
end
bitmap.fill_rect(0,0,bitmap.width,1,black)
bitmap.fill_rect(0,bitmap.height-1,bitmap.width,1,black)
bitmap.fill_rect(0,0,1,bitmap.height,black)
bitmap.fill_rect(bitmap.width-1,0,1,bitmap.height,black)
return bitmap
end
|
#createMinimap2(mapid) ⇒ Object
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
|
# File 'scripts/Editor.rb', line 3384
def createMinimap2(mapid)
map=load_data(sprintf("Data/Map%03d.rxdata",mapid)) rescue nil
return BitmapWrapper.new(32,32) if !map
bitmap=BitmapWrapper.new(map.width*4,map.height*4)
black=Color.new(0,0,0)
bigmap=(map.width>40 && map.height>40)
tilesets=load_data("Data/Tilesets.rxdata")
tileset=tilesets[map.tileset_id]
return bitmap if !tileset
helper=TileDrawingHelper.fromTileset(tileset)
for y in 0...map.height
for x in 0...map.width
if bigmap
next if (x>8 && x<=map.width-8 && y>8 && y<=map.height-8)
end
for z in 0..2
id=map.data[x,y,z]
next if id==0 || !id
helper.bltSmallTile(bitmap,x*4,y*4,4,4,id)
end
end
end
bitmap.fill_rect(0,0,bitmap.width,1,black)
bitmap.fill_rect(0,bitmap.height-1,bitmap.width,1,black)
bitmap.fill_rect(0,0,1,bitmap.height,black)
bitmap.fill_rect(bitmap.width-1,0,1,bitmap.height,black)
return bitmap
end
|
#createRegionMap(map) ⇒ Object
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
|
# File 'scripts/Editor.rb', line 3354
def createRegionMap(map)
pbRgssOpen("Data/townmap.dat","rb"){|f|
@mapdata=Marshal.load(f)
}
@map=@mapdata[map]
bitmap=AnimatedBitmap.new("Graphics/Pictures/#{@map[1]}").deanimate
retbitmap=BitmapWrapper.new(bitmap.width/2,bitmap.height/2)
retbitmap.stretch_blt(
Rect.new(0,0,bitmap.width/2,bitmap.height/2),
bitmap,
Rect.new(0,0,bitmap.width,bitmap.height)
)
bitmap.dispose
return retbitmap
end
|
#csvBoolean!(str, line = -1)) ⇒ Object
394
395
396
397
398
399
400
401
402
403
404
|
# File 'scripts/Compiler.rb', line 394
def csvBoolean!(str,line=-1)
field=csvfield!(str)
if field[/^1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]$/]
return true
elsif field[/^0|[Ff][Aa][Ll][Ss][Ee]|[Nn][Oo]$/]
return false
else
raise _INTL("El campo {1} no tiene un valor booleano (true, false, 1, 0)\r\n{2}",field,FileLineData.linereport)
return false
end
end
|
#csvEnumField!(value, enumer, key, section) ⇒ Object
427
428
429
430
|
# File 'scripts/Compiler.rb', line 427
def csvEnumField!(value,enumer,key,section)
ret=csvfield!(value)
return checkEnumField(ret,enumer)
end
|
#csvEnumFieldOrInt!(value, enumer, key, section) ⇒ Object
432
433
434
435
436
437
438
|
# File 'scripts/Compiler.rb', line 432
def csvEnumFieldOrInt!(value,enumer,key,section)
ret=csvfield!(value)
if ret[/\-?\d+/]
return ret.to_i
end
return checkEnumField(ret,enumer)
end
|
#csvfield!(str) ⇒ Object
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
# File 'scripts/Compiler.rb', line 350
def csvfield!(str)
ret=""
str.sub!(/^\s*/,"")
if str[0,1]=="\""
str[0,1]=""
escaped=false
fieldbytes=0
str.scan(/./) do |s|
fieldbytes+=s.length
break if s=="\"" && !escaped
if s=="\\" && !escaped
escaped=true
else
ret+=s
escaped=false
end
end
str[0,fieldbytes]=""
if !str[/^\s*,/] && !str[/^\s*$/]
raise _INTL("Campo entrecomillado inválido (en: {1})\r\n{2}",str,FileLineData.linereport)
end
str[0,str.length]=$~.post_match
else
if str[/,/]
str[0,str.length]=$~.post_match
ret=$~.pre_match
else
ret=str.clone
str[0,str.length]=""
end
ret.gsub!(/\s+$/,"")
end
return ret
end
|
#csvFloat!(str, key, section) ⇒ Object
422
423
424
425
|
# File 'scripts/Compiler.rb', line 422
def csvFloat!(str,key,section)
ret=csvfield!(str)
return Float(ret) rescue raise _INTL("El campo {1} no tiene un valor numérico\r\n{2}",ret,FileLineData.linereport)
end
|
#csvInt!(str, line = -1)) ⇒ Object
406
407
408
409
410
411
412
|
# File 'scripts/Compiler.rb', line 406
def csvInt!(str,line=-1)
ret=csvfield!(str)
if !ret[/^\-?\d+$/]
raise _INTL("El campo {1} no tiene un valor entero\r\n{2}",ret,FileLineData.linereport)
end
return ret.to_i
end
|
#csvPosInt!(str, line = -1)) ⇒ Object
414
415
416
417
418
419
420
|
# File 'scripts/Compiler.rb', line 414
def csvPosInt!(str,line=-1)
ret=csvfield!(str)
if !ret[/^\d+$/]
raise _INTL("El campo {1} no tiene un valor entero positivo\r\n{2}",ret,FileLineData.linereport)
end
return ret.to_i
end
|
#csvquote(str) ⇒ Object
385
386
387
388
389
390
391
392
|
# File 'scripts/Compiler.rb', line 385
def csvquote(str)
return "" if !str || str==""
if str[/[,\"]/] str=str.gsub(/[\"]/,"\\\"")
str="\"#{str}\""
end
return str
end
|
#ctag(color) ⇒ Object
113
114
115
116
117
118
119
|
# File 'scripts/DrawText.rb', line 113
def ctag(color)
ret=(color.red.to_i<<24)
ret|=((color.green.to_i)<<16)
ret|=((color.blue.to_i)<<8)
ret|=((color.alpha.to_i))
return sprintf("<c=%08X>",ret)
end
|
#curveToPointPath(curve, numpoints) ⇒ Object
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
|
# File 'scripts/BattleAnimationEditor.rb', line 3185
def curveToPointPath(curve,numpoints)
if numpoints<2
return nil
end
path=PointPath.new
step=1.0/(numpoints-1)
t=0.0
for i in 0...numpoints
point=getCurvePoint(curve,t)
path.addPoint(point[0],point[1])
t+=step
end
return path
end
|
#decodeInt(strm) ⇒ Object
626
627
628
629
630
631
632
633
634
635
636
|
# File 'scripts/Compiler.rb', line 626
def decodeInt(strm)
bits=0
curbyte=0
ret=0
begin
curbyte=strm.fgetb
ret+=(curbyte&0x7F)<<bits
bits+=7
end while(((curbyte&0x80)>0)&&bits<0x1d)
return ret
end
|
#decodeString(strm) ⇒ Object
647
648
649
650
|
# File 'scripts/Compiler.rb', line 647
def decodeString(strm)
len=decodeInt(strm)
return strm.read(len)
end
|
#drawBitmapBuffer(chars) ⇒ Object
950
951
952
953
954
955
956
957
958
959
960
961
962
|
# File 'scripts/DrawText.rb', line 950
def drawBitmapBuffer(chars)
width=1
height=1
for ch in chars
chx=ch[1]+ch[3]
chy=ch[2]+ch[4]
width=chx if width<chx
height=chy if height<chy
end
buffer=Bitmap.new(width,height)
drawFormattedChars(buffer,chars)
return buffer
end
|
#drawColoredTextEx(bitmap, x, y, width, text, baseColor = nil, shadowColor = nil) ⇒ Object
Deprecated – not to be used in new code
1129
1130
1131
1132
|
# File 'scripts/DrawText.rb', line 1129
def drawColoredTextEx(bitmap,x,y,width,text,baseColor=nil,shadowColor=nil)
chars=getFormattedText(bitmap,x,y,width,-1,coloredToFormattedText(text),32)
drawFormattedChars(bitmap,chars)
end
|
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
|
# File 'scripts/DrawText.rb', line 1032
def drawFormattedChars(bitmap,chars)
if chars.length==0||!bitmap||bitmap.disposed?
return
end
oldfont=bitmap.font.clone
for ch in chars
drawSingleFormattedChar(bitmap,ch)
end
bitmap.font=oldfont
end
|
#drawFormattedTextEx(bitmap, x, y, width, text, baseColor = nil, shadowColor = nil) ⇒ Object
1075
1076
1077
1078
1079
1080
1081
|
# File 'scripts/DrawText.rb', line 1075
def drawFormattedTextEx(bitmap,x,y,width,text,baseColor=nil,shadowColor=nil)
base=!baseColor ? Color.new(12*8,12*8,12*8) : baseColor.clone
shadow=!shadowColor ? Color.new(26*8,26*8,25*8) : shadowColor.clone
text="<c2="+colorToRgb16(base)+colorToRgb16(shadow)+">"+text
chars=getFormattedText(bitmap,x,y,width,-1,text,32)
drawFormattedChars(bitmap,chars)
end
|
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
|
# File 'scripts/DrawText.rb', line 964
def drawSingleFormattedChar(bitmap,ch)
if ch[5] graphic=Bitmap.new(ch[0])
graphicRect=ch[15]
bitmap.blt(ch[1], ch[2], graphic,graphicRect,ch[8].alpha)
graphic.dispose
else
if bitmap.font.size!=ch[13]
bitmap.font.size=ch[13]
end
if ch[0]!="\n" && ch[0]!="\r" && ch[0]!=" " && !isWaitChar(ch[0])
if bitmap.font.bold!=ch[6]
bitmap.font.bold=ch[6]
end
if bitmap.font.italic!=ch[7]
bitmap.font.italic=ch[7]
end
if bitmap.font.name!=ch[12]
bitmap.font.name=ch[12]
end
offset=0
if ch[9] bitmap.font.color=ch[9]
if (ch[16]&1)!=0 offset=1
bitmap.draw_text(ch[1],ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+1,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+2,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+1,ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+1,ch[2]+2,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2]+1,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2]+2,ch[3]+2,ch[4],ch[0])
elsif (ch[16]&2)!=0 offset=2
bitmap.draw_text(ch[1],ch[2],ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+2,ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+4,ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2],ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2]+4,ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1]+4,ch[2],ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1]+4,ch[2]+2,ch[3]+4,ch[4],ch[0])
bitmap.draw_text(ch[1]+4,ch[2]+4,ch[3]+4,ch[4],ch[0])
else
bitmap.draw_text(ch[1]+2,ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+2,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2]+2,ch[3]+2,ch[4],ch[0])
end
end
if bitmap.font.color!=ch[8]
bitmap.font.color=ch[8]
end
bitmap.draw_text(ch[1]+offset,ch[2]+offset,ch[3],ch[4],ch[0])
else
if bitmap.font.color!=ch[8]
bitmap.font.color=ch[8]
end
end
if ch[10] bitmap.fill_rect(ch[1],ch[2]+ch[4]-[(ch[4]-bitmap.font.size)/2,0].max-2,
ch[3]-2,2,ch[8])
end
if ch[11] bitmap.fill_rect(ch[1],ch[2]+(ch[4]/2),ch[3]-2,2,ch[8])
end
end
end
|
#drawTextEx(bitmap, x, y, width, numlines, text, baseColor, shadowColor) ⇒ Object
1059
1060
1061
1062
1063
|
# File 'scripts/DrawText.rb', line 1059
def drawTextEx(bitmap,x,y,width,numlines,text,baseColor,shadowColor)
normtext=getLineBrokenChunks(bitmap,text,width,nil,true)
renderLineBrokenChunksWithShadow(bitmap,x,y,normtext,numlines*32,
baseColor,shadowColor)
end
|
#drawTextExMulti(bitmap, x, y, width, numlines, text, baseColor, shadowColor) ⇒ Object
1110
1111
1112
1113
|
# File 'scripts/DrawText.rb', line 1110
def drawTextExMulti(bitmap,x,y,width,numlines,text,baseColor,shadowColor)
normtext=getLineBrokenChunks(bitmap,text,width,nil,true)
renderMultiLine(bitmap,x,y,normtext,numlines*32,baseColor,shadowColor)
end
|
#drawTextTable(bitmap, x, y, totalWidth, rowHeight, columnWidthPercents, table) ⇒ Object
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
|
# File 'scripts/DrawText.rb', line 1043
def drawTextTable(bitmap,x,y,totalWidth,rowHeight,columnWidthPercents,table)
yPos=y
for i in 0...table.length
row=table[i]
xPos=x
for j in 0...row.length
cell=row[j]
cellwidth=columnWidthPercents[j]*totalWidth/100
chars=getFormattedText(bitmap,xPos,yPos,cellwidth,-1,cell,rowHeight)
drawFormattedChars(bitmap,chars)
xPos+=cellwidth
end
yPos+=rowHeight
end
end
|
#dumpBase64Anim(s) ⇒ Object
2899
2900
2901
|
# File 'scripts/BattleAnimationEditor.rb', line 2899
def dumpBase64Anim(s)
return [Zlib::Deflate.deflate(Marshal.dump(s))].pack("m").gsub(/\n/,"\r\n")
end
|
#encodeInt(strm, value) ⇒ Object
613
614
615
616
617
618
619
620
621
622
623
624
|
# File 'scripts/Compiler.rb', line 613
def encodeInt(strm,value)
num=0
loop do
if value<0x80
strm.fputb(value)
return num+1
end
strm.fputb(0x80|(value&0x7F))
value>>=7
num+=1
end
end
|
#encodeString(strm, str) ⇒ Object
642
643
644
645
|
# File 'scripts/Compiler.rb', line 642
def encodeString(strm,str)
encodeInt(strm,str.length)
strm.write(str)
end
|
#evolutions(move) ⇒ Object
174
175
176
177
178
179
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 174
def evolutions(move)
if !$evolutions[move]
$evolutions[move]=pbGetEvolvedFormData(move)
end
return $evolutions[move]
end
|
#exit(code = 0) ⇒ Object
51
52
53
54
55
56
|
# File 'scripts/Audio.rb', line 51
def exit(code=0)
for p in $AtExitProcs
p.call
end
raise SystemExit.new(code)
end
|
#findIndex(a) ⇒ Object
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'scripts/Compiler.rb', line 149
def findIndex(a)
index=-1
count=0
a.each {|i|
if yield i
index=count
break
end
count+=1
}
return index
end
|
#fmtescape(text) ⇒ Object
1065
1066
1067
1068
1069
1070
1071
1072
1073
|
# File 'scripts/DrawText.rb', line 1065
def fmtescape(text)
if text[/[&<>]/]
text2=text.gsub(/&/,"&")
text2.gsub!(/</,"<")
text2.gsub!(/>/,">")
return text2
end
return text
end
|
#frozenArrayValue(arr) ⇒ Object
685
686
687
688
689
690
691
692
693
694
|
# File 'scripts/Compiler.rb', line 685
def frozenArrayValue(arr)
typestring=""
for i in 0...arr.length
if i>0
typestring+=((i%20)==0) ? ",\r\n" : ","
end
typestring+=arr[i].to_s
end
return "["+typestring+"].freeze"
end
|
#getBattleSpriteMetricOffset(species, index, metrics = nil) ⇒ Object
Ajustes de la posición del sprite
362
363
364
365
366
367
368
369
370
371
372
|
# File 'scripts/Pokemon_Sprites.rb', line 362
def getBattleSpriteMetricOffset(species,index,metrics=nil)
metrics=load_data("Data/metrics.dat") if !metrics
ret=0
if index==1 || index==3 ret+=(metrics[1][species] || 0)*2 ret-=(metrics[2][species] || 0)*2 else ret+=(metrics[0][species] || 0)*2
end
return ret
end
|
#getCatmullRomPoint(src, t) ⇒ Object
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
|
# File 'scripts/BattleAnimationEditor.rb', line 3163
def getCatmullRomPoint(src,t)
x=0,y=0
t*=3.0
if t<1.0
x=catmullRom(src[0].x,src[0].x,src[1].x,src[2].x,t)
y=catmullRom(src[0].y,src[0].y,src[1].y,src[2].y,t)
elsif t<2.0
t-=1.0
x=catmullRom(src[0].x,src[1].x,src[2].x,src[3].x,t)
y=catmullRom(src[0].y,src[1].y,src[2].y,src[3].y,t)
else
t-=2.0
x=catmullRom(src[1].x,src[2].x,src[3].x,src[3].x,t)
y=catmullRom(src[1].y,src[2].y,src[3].y,src[3].y,t)
end
return [x,y]
end
|
#getConstantName(mod, value) ⇒ Object
727
728
729
730
731
732
|
# File 'scripts/Compiler.rb', line 727
def getConstantName(mod,value)
for c in mod.constants
return c if mod.const_get(c.to_sym)==value
end
raise _INTL("El valor {1} no está definido como una constante en {2}",value,mod.name)
end
|
#getContrastColor(color) ⇒ Object
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'scripts/DrawText.rb', line 165
def getContrastColor(color)
raise "No color given" if !color
r=color.red; g=color.green; b=color.blue
yuv=[
r * 0.299 + g * 0.587 + b * 0.114,
r * -0.1687 + g * -0.3313 + b * 0.500 + 0.5,
r * 0.500 + g * -0.4187 + b * -0.0813 + 0.5
]
if yuv[0]<127.5
yuv[0]+=(255-yuv[0])/2
else
yuv[0]=yuv[0]/2
end
return Color.new(
yuv[0] + 1.4075 * (yuv[2] - 0.5),
yuv[0] - 0.3455 * (yuv[1] - 0.5) - 0.7169 * (yuv[2] - 0.5),
yuv[0] + 1.7790 * (yuv[1] - 0.5),
color.alpha
)
end
|
#getCubicPoint2(src, t) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'scripts/EventScene.rb', line 1
def getCubicPoint2(src,t)
x0 = src[0]; y0 = src[1]
cx0 = src[2]; cy0 = src[3]
cx1 = src[4]; cy1 = src[5]
x1 = src[6]; y1 = src[7]
x1 = cx1+(x1-cx1)*t
y1 = cy1+(y1-cy1)*t
x0 = x0+(cx0-x0)*t
y0 = y0+(cy0-y0)*t
cx0 = cx0+(cx1-cx0)*t
cy0 = cy0+(cy1-cy0)*t
cx1 = cx0+(x1-cx0)*t
cy1 = cy0+(y1-cy0)*t
cx0 = x0+(cx0-x0)*t
cy0 = y0+(cy0-y0)*t
cx = cx0+(cx1-cx0)*t
cy = cy0+(cy1-cy0)*t
return [cx,cy]
end
|
#getCurvePoint(src, t) ⇒ Object
3181
3182
3183
|
# File 'scripts/BattleAnimationEditor.rb', line 3181
def getCurvePoint(src,t)
return getCatmullRomPoint(src,t)
end
|
#getDefaultTextColors(windowskin) ⇒ Object
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
|
# File 'scripts/SpriteWindow.rb', line 1078
def getDefaultTextColors(windowskin)
if !windowskin || windowskin.disposed? ||
windowskin.width!=128 || windowskin.height!=128
if isDarkWindowskin(windowskin)
return [MessageConfig::LIGHTTEXTBASE,MessageConfig::LIGHTTEXTSHADOW] else
return [MessageConfig::DARKTEXTBASE,MessageConfig::DARKTEXTSHADOW] end
else color=windowskin.get_pixel(64, 96)
shadow=nil
isdark=(color.red+color.green+color.blue)/3 < 128
if isdark
shadow=Color.new(color.red+64,color.green+64,color.blue+64)
else
shadow=Color.new(color.red-64,color.green-64,color.blue-64)
end
return [color,shadow]
end
end
|
#getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = 32, newlineBreaks = true, explicitBreaksOnly = false, collapseAlignments = false) ⇒ Object
Formats a string of text and returns an array containing a list of formatted characters.
Parameters: bitmap: Source bitmap. Will be used to determine the default font of the text. xDst: X coordinate of the text's top left corner. yDst: Y coordinate of the text's top left corner. widthDst: Width of the text. Used to determine line breaks. heightDst: Height of the text. If -1, there is no height restriction. If 1
or greater, any characters exceeding the height are removed from the returned
list.
newLineBreaks: If true, newline characters will be treated as line breaks.
The default is true.
Return Values: A list of formatted characters. Returns an empty array if bitmap is nil or disposed, or if widthDst is 0 or less or heightDst is 0.
Formatting Specification: This function uses the following syntax when formatting the text. … - Formats the text in bold. … - Formats the text in italics. <u> … </u> - Underlines the text. <s> … </s> - Draws a strikeout line over the text. <r> - Right-aligns the text until the next line break.
- Causes a line break. <c=X> … </c> - Color specification. A total of four formats are supported:
RRGGBBAA, RRGGBB, 16-bit RGB, and Window_Base color numbers.
<c2=X> … </c2> - Color specification where the first half is the base color and
the second half is the shadow color. 16-bit RGB is supported.
<fn=X> … </fn> - Formats the text in the specified font, or Arial
if the font doesn't exist.
<fs=X> … </fs> - Changes the font size to X. <ac> … </ac> - Centers the text. Causes line breaks before and
after the text.
<al> … </al> - Left-aligns the text. Causes line breaks before and
after the text.
<ar> … </ar> - Right-aligns the text. Causes line breaks before and
after the text.
<icon=X> - Displays the icon X (in Graphics/Icons/). Added 2009-9-12 <o=X> - Displays the text in the given opacity (0-255) Added 2009-10-19 <outln> - Displays the text in outline format. Added 2010-05-12 <outln2> - Displays the text in outline format (outlines more exaggerated. Added 2009-10-20 <c3=B,S> … </c3> - Color specification where B is the base color and
S is the shadow color. B and/or S can be omitted. A total of four formats are supported:
RRGGBBAA, RRGGBB, 16-bit RGB, and Window_Base color numbers.
In addition, the syntax supports the following: ' - Converted to “'”. < - Converted to “<”. > - Converted to “>”. & - Converted to “&”. " - Converted to double quotation mark.
To draw the characters, pass the returned array to the drawFormattedChars function.
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
|
# File 'scripts/DrawText.rb', line 482
def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
newlineBreaks=true,explicitBreaksOnly=false,
collapseAlignments=false)
dummybitmap=nil
if !bitmap || bitmap.disposed? dummybitmap=Bitmap.new(1,1)
bitmap=dummybitmap
return
end
if !bitmap || bitmap.disposed? || widthDst<=0 || heightDst==0 || text.length==0
return []
end
textchunks=[]
controls=[]
oldtext=text
while text[FORMATREGEXP]
textchunks.push($~.pre_match)
if $~[3]
controls.push([$~[2].downcase,$~[4],-1,$~[1]=="/" ? true : false])
else
controls.push([$~[2].downcase,"",-1,$~[1]=="/" ? true : false])
end
text=$~.post_match
end
if controls.length==0
ret=getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
newlineBreaks,explicitBreaksOnly)
dummybitmap.dispose if dummybitmap
return ret
end
numchars=0
x=y=0
characters=[]
charactersInternal=[]
charsonline=0
realtext=nil
realtextStart=""
if !explicitBreaksOnly && textchunks.join("").length==0
realtext=(newlineBreaks) ? text : text.gsub(/\n/," ")
realtextStart=oldtext[0,oldtext.length-realtext.length]
realtextHalf=text.length/2
end
textchunks.push(text)
for chunk in textchunks
chunk.gsub!(/</,"<")
chunk.gsub!(/>/,">")
chunk.gsub!(/'/,"'")
chunk.gsub!(/"/,"\"")
chunk.gsub!(/&/,"&")
end
textlen=0
for i in 0...controls.length
textlen+=textchunks[i].scan(/./m).length
controls[i][2]=textlen
end
text=textchunks.join("")
textchars=text.scan(/./m)
colorstack=[]
boldcount=0
italiccount=0
outlinecount=0
underlinecount=0
strikecount=0
rightalign=0
outline2count=0
opacitystack=[]
oldfont=bitmap.font.clone
defaultfontname=bitmap.font.name
defaultfontsize=bitmap.font.size
fontsize=defaultfontsize
fontnamestack=[]
fontsizestack=[]
defaultcolors=[oldfont.color.clone,nil]
if defaultfontname.is_a?(Array)
defaultfontname=defaultfontname.find{|i| Font.exist?(i)} || "Arial"
elsif !Font.exist?(defaultfontname)
defaultfontname="Arial"
end
defaultfontname=defaultfontname.clone
fontname=defaultfontname
alignstack=[]
lastword=[0,0] hadspace=false
hadnonspace=false
havenl=false
position=0;while position<textchars.length
nextline=0
graphic=nil
graphicX=0
graphicY=0
graphicWidth=nil
graphicHeight=nil
graphicRect=nil
for i in 0...controls.length
if controls[i] && controls[i][2]==position
control=controls[i][0]
param=controls[i][1]
endtag=controls[i][3]
if control=="c"
if endtag
colorstack.pop
else
color=rgbToColor(param)
colorstack.push([color,nil])
end
elsif control=="c2"
if endtag
colorstack.pop
else
base=Rgb16ToColor(param[0,4])
shadow=Rgb16ToColor(param[4,4])
colorstack.push([base,shadow])
end
elsif control=="c3"
if endtag
colorstack.pop
else
param=param.split(",")
oldColors=getLastParam(colorstack,defaultcolors)
base=(param[0] && param[0]!="") ? rgbToColor(param[0]) : oldColors[0]
shadow=(param[1] && param[1]!="") ? rgbToColor(param[1]) : oldColors[1]
colorstack.push([base,shadow])
end
elsif control=="o"
if endtag
opacitystack.pop
else
opacitystack.push(param.sub(/\s+$/,"").to_i)
end
elsif control=="b"
boldcount+=(endtag ? -1 : 1)
elsif control=="i"
italiccount+=(endtag ? -1 : 1)
elsif control=="u"
underlinecount+=(endtag ? -1 : 1)
elsif control=="s"
strikecount+=(endtag ? -1 : 1)
elsif control=="outln"
outlinecount+=(endtag ? -1 : 1)
elsif control=="outln2"
outline2count+=(endtag ? -1 : 1)
elsif control=="fs" if endtag
fontsizestack.pop
else
fontsizestack.push(param.sub(/\s+$/,"").to_i)
end
fontsize=getLastParam(fontsizestack,defaultfontsize)
bitmap.font.size=fontsize
elsif control=="fn" if endtag
fontnamestack.pop
else
fontname=param.sub(/\s+$/,"")
fontnamestack.push(Font.exist?(fontname) ? fontname : "Arial")
end
fontname=getLastParam(fontnamestack,defaultfontname)
bitmap.font.name=fontname
elsif control=="ar" if !endtag
alignstack.push(1)
nextline=1 if x>0 && nextline==0
else
alignstack.pop
nextline=1 if x>0 && nextline==0
end
elsif control=="al" if !endtag
alignstack.push(0)
nextline=1 if x>0 && nextline==0
else
alignstack.pop;
nextline=1 if x>0 && nextline==0
end
elsif control=="ac" if !endtag
alignstack.push(2)
nextline=1 if x>0 && nextline==0
else
alignstack.pop;
nextline=1 if x>0 && nextline==0
end
elsif control=="icon" if !endtag
param=param.sub(/\s+$/,"")
graphic="Graphics/Icons/#{param}"
controls[i]=nil
break
end
elsif control=="img" if !endtag
param=param.sub(/\s+$/,"")
param=param.split("|")
graphic=param[0]
if param.length>1
graphicX=param[1].to_i
graphicY=param[2].to_i
graphicWidth=param[3].to_i
graphicHeight=param[4].to_i
end
controls[i]=nil
break
end
elsif control=="br" if !endtag
nextline+=1
end
elsif control=="r" if !endtag
x=0
rightalign=1;lastword=[characters.length,x]
end
end
controls[i]=nil
end
end
bitmap.font.bold=(boldcount>0)
bitmap.font.italic=(italiccount>0)
if graphic
if !graphicWidth
tempgraphic=Bitmap.new(graphic)
graphicWidth=tempgraphic.width
graphicHeight=tempgraphic.height
tempgraphic.dispose
end
width=graphicWidth xStart=0 yStart=[(lineheight/2)-(graphicHeight/2),0].max
graphicRect=Rect.new(graphicX,graphicY,graphicWidth,graphicHeight)
else
yStart=0
xStart=0
width=isWaitChar(textchars[position]) ? 0 : bitmap.text_size(textchars[position]).width
width+=2 if width>0 && outline2count>0
end
if rightalign==1 && nextline==0
alignment=1
else
alignment=getLastParam(alignstack,0)
end
nextline.times do
havenl=true
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,false,
defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil,0])
charactersInternal.push([alignment,y,0])
y+=1;
x=0;
rightalign=0;
lastword=[characters.length,x]
hadspace=false
hadnonspace=false
end
if textchars[position]=="\n"
if newlineBreaks
if nextline==0
havenl=true
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,false,
defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil,0])
charactersInternal.push([alignment,y,0])
y+=1
x=0
end
rightalign=0
hadspace=true
hadnonspace=false
position+=1
next
else
textchars[position]=" "
if !graphic
width=bitmap.text_size(textchars[position]).width
width+=2 if width>0 && outline2count>0
end
end
end
isspace=(textchars[position][/\s/] || isWaitChar(textchars[position])) ? true : false
if hadspace && !isspace
lastword[0]=characters.length
lastword[1]=x
hadspace=false
hadnonspace=true
elsif isspace
hadspace=true
end
textx=x+xStart texty=(lineheight*y)+yDst+yStart
colors=getLastColors(colorstack,opacitystack,defaultcolors)
oldx=x
if heightDst<0 || texty<yDst+heightDst
havenl=true if !graphic && isWaitChar(textchars[position])
=(!graphic && italiccount>0) ? 2+(width/2) : 2
characters.push([
graphic ? graphic : textchars[position],
x+xStart,texty,width+,lineheight,
graphic ? true : false,
(boldcount>0),(italiccount>0),colors[0],colors[1],
(underlinecount>0),(strikecount>0),fontname,fontsize,
position,graphicRect,
((outlinecount>0) ? 1 : 0)+((outline2count>0) ? 2 : 0)
])
charactersInternal.push([alignment,y,xStart,textchars[position],])
end
x+=width
if !explicitBreaksOnly && x+2>widthDst && lastword[1]!=0 &&
(!hadnonspace || !hadspace)
havenl=true
characters.insert(lastword[0],["\n",x,y*lineheight+yDst,0,lineheight,false,
false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position,
nil])
charactersInternal.insert(lastword[0],[alignment,y,0])
lastword[0]+=1
y+=1
x=0
for i in lastword[0]...characters.length
characters[i][2]+=lineheight
charactersInternal[i][1]+=1
=(charactersInternal[i][4]) ? charactersInternal[i][4] : 0
charwidth=characters[i][3]-
characters[i][1]=x+charactersInternal[i][2]
x+=charwidth
end
lastword[1]=0
end
position+=1 if !graphic
end
numlines=(x==0 && y>0) ? y : y+1
if numlines==2 && realtext && !realtext[/\n/] && realtext.length>=50
half=realtext.length/2
leftSearch=0
rightSearch=0
i=half; while i>=0
if realtext[i,1][/\s/]||isWaitChar(realtext[i,1])
break
end
leftSearch+=1
i-=1
end
i=half; while i<realtext.length
if realtext[i,1][/\s/]||isWaitChar(realtext[i,1])
break
end
rightSearch+=1
i+=1
end
trialHalf=half+((rightSearch<leftSearch) ? rightSearch : -leftSearch)
if trialHalf!=0 && trialHalf!=realtext.length
newText=realtext.clone
if isWaitChar(newText[trialHalf,1])
newText.insert(trialHalf+1,"\n")
else
newText.insert(trialHalf,"\n")
newText.gsub!(/\n\s+/,"\n")
end
bitmap.font=oldfont
dummybitmap.dispose if dummybitmap
return getFormattedText(dummybitmap ? nil : bitmap,xDst,yDst,
widthDst,heightDst,realtextStart+newText,
lineheight,true,explicitBreaksOnly)
end
end
if havenl
firstspace=-1
for i in 0...characters.length
if characters[i][5]!=false firstspace=-1
elsif (characters[i][0]=="\n" || isWaitChar(characters[i][0])) &&
firstspace>=0
for j in firstspace...i
characters[j]=nil
charactersInternal[j]=nil
end
firstspace=-1
elsif characters[i][0][/[ \r\t]/]
if firstspace<0
firstspace=i
end
else
firstspace=-1
end
end
if firstspace>0
for j in firstspace...characters.length
characters[j]=nil
charactersInternal[j]=nil
end
end
characters.compact!
charactersInternal.compact!
end
totalwidth=0
widthblocks=[]
lastalign=0
lasty=0
runstart=0
for i in 0...characters.length
c=characters[i]
if i>0 && (charactersInternal[i][0]!=lastalign ||
charactersInternal[i][1]!=lasty)
widthblocks.push([runstart,i,lastalign,totalwidth,lasty])
runstart=i
totalwidth=0
end
lastalign=charactersInternal[i][0]
lasty=charactersInternal[i][1]
=(charactersInternal[i][4]) ? charactersInternal[i][4] : 0
totalwidth+=c[3]-
end
widthblocks.push([runstart,characters.length,lastalign,totalwidth,lasty])
if collapseAlignments
totalLineWidths=[]
for block in widthblocks
y=block[4]
if !totalLineWidths[y]
totalLineWidths[y]=0
end
if totalLineWidths[y]!=0
totalLineWidths[y]+=16
end
totalLineWidths[y]+=block[3]
end
widthDst=[widthDst,(totalLineWidths.compact.max||0)].min
end
for block in widthblocks
next if block[0]>=block[1]
for i in block[0]...block[1]
case block[2]
when 1; characters[i][1]=xDst+(widthDst-block[3]-4)+characters[i][1]
when 2; characters[i][1]=xDst+((widthDst/2)-(block[3]/2))+characters[i][1]
else; characters[i][1]=xDst+characters[i][1]
end
end
end
if heightDst>=0
for i in 0...characters.length
if characters[i][2]>=yDst+heightDst
characters[i]=nil
end
end
characters.compact!
end
bitmap.font=oldfont
dummybitmap.dispose if dummybitmap
return characters
end
|
#getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight, newlineBreaks = true, explicitBreaksOnly = false) ⇒ Object
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
# File 'scripts/DrawText.rb', line 240
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
newlineBreaks=true,explicitBreaksOnly=false)
numchars=0
x=y=0
characters=[]
charactersInternal=[]
textchunks=[]
controls=[]
charsonline=0
textchunks.push(text)
text=textchunks.join("")
textchars=text.scan(/./m)
lastword=[0,0] hadspace=false
hadnonspace=false
bold=bitmap.font.bold
italic=bitmap.font.italic
colorclone=bitmap.font.color
defaultfontname=bitmap.font.name
if defaultfontname.is_a?(Array)
defaultfontname=defaultfontname.find{|i| Font.exist?(i)} || "Arial"
elsif !Font.exist?(defaultfontname)
defaultfontname="Arial"
end
defaultfontname=defaultfontname.clone
havenl=false
position=0;while position<textchars.length
yStart=0
xStart=0
width=isWaitChar(textchars[position]) ? 0 : bitmap.text_size(textchars[position]).width
if textchars[position]=="\n"
if newlineBreaks if true
havenl=true
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,
false,colorclone,nil,false,false,"",8,position,nil,0])
y+=1
x=0
end
hadspace=true
hadnonspace=false
position+=1
next
else textchars[position]=" "
end
end
isspace=(textchars[position][/\s/]||isWaitChar(textchars[position])) ? true : false
if hadspace && !isspace
lastword[0]=characters.length
lastword[1]=x
hadspace=false
hadnonspace=true
elsif isspace
hadspace=true
end
textx=x+xStart texty=(lineheight*y)+yDst+yStart
oldx=x
if heightDst<0 || yStart<yDst+heightDst
havenl=true if isWaitChar(textchars[position])
characters.push([
textchars[position],
x+xStart,texty+yStart,width+2,lineheight,
false,bold,italic,colorclone,nil,false,false,
defaultfontname,bitmap.font.size,position,nil,0])
end
x+=width
if !explicitBreaksOnly && x+2>widthDst && lastword[1]!=0 &&
(!hadnonspace || !hadspace)
havenl=true
characters.insert(lastword[0],["\n",x,y*lineheight+yDst,0,lineheight,
false,false,false,colorclone,nil,false,false,"",8,position])
lastword[0]+=1
y+=1
x=0
for i in lastword[0]...characters.length
characters[i][2]+=lineheight
charwidth=characters[i][3]-2
characters[i][1]=x
x+=charwidth
end
lastword[1]=0
end
position+=1
end
numlines=(x==0 && y>0) ? y-1 : y
realtext=(newlineBreaks) ? text : text.gsub(/\n/," ")
if numlines==2 && !explicitBreaksOnly && !realtext[/\n/] && realtext.length>=50
half=realtext.length/2
leftSearch=0
rightSearch=0
i=half; while i>=0
if realtext[i,1][/\s/]||isWaitChar(realtext[i])
break
end
leftSearch+=1
i-=1
end
i=half; while i<realtext.length
if realtext[i,1][/\s/]||isWaitChar(realtext[i])
break
end
rightSearch+=1
i+=1
end
trialHalf=half+((leftSearch<rightSearch) ? -leftSearch : rightSearch)
if trialHalf!=0 && trialHalf!=realtext.length
newText=realtext.clone
newText.insert(trialHalf,"\n")
return getFormattedTextFast(bitmap,xDst,yDst,
widthDst,heightDst,newText,lineheight,true,explicitBreaksOnly)
end
end
if havenl
firstspace=-1
for i in 0...characters.length
if characters[i][5]!=false firstspace=-1
elsif (characters[i][0]=="\n" || isWaitChar(characters[i][0])) &&
firstspace>=0
for j in firstspace...i
characters[j]=nil
end
firstspace=-1
elsif characters[i][0][/[ \r\t]/]
if firstspace<0
firstspace=i
end
else
firstspace=-1
end
end
if firstspace>0
for j in firstspace...characters.length
characters[j]=nil
end
end
characters.compact!
end
for i in 0...characters.length
characters[i][1]=xDst+characters[i][1]
end
if heightDst>=0
for i in 0...characters.length
if characters[i][2]>=yDst+heightDst
characters[i]=nil
end
end
characters.compact!
end
return characters
end
|
#getFormattedTextForDims(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight, newlineBreaks = true, explicitBreaksOnly = false) ⇒ Object
228
229
230
231
232
233
234
235
236
237
238
|
# File 'scripts/DrawText.rb', line 228
def getFormattedTextForDims(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
newlineBreaks=true,explicitBreaksOnly=false)
text2=text.gsub(/<(\/?)([Cc]|[Cc][2]|[Cc][3]|[Oo]|[Uu]|[Ss])(\s*\=\s*([^>]*))?>/,"")
if newlineBreaks
text2.gsub!(/<(\/?)([Bb][Rr])(\s*\=\s*([^>]*))?>/,"\n")
end
return getFormattedText(
bitmap,xDst,yDst,widthDst,heightDst,
text2,lineheight,newlineBreaks,
explicitBreaksOnly,true)
end
|
#getKnownFolder(guid) ⇒ Object
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
# File 'scripts/SpriteWindow.rb', line 445
def getKnownFolder(guid)
packedGuid=guid.pack("VvvC*")
shGetKnownFolderPath=Win32API.new("shell32.dll","SHGetKnownFolderPath","pllp","i") rescue nil
coTaskMemFree=Win32API.new("ole32.dll","CoTaskMemFree","i","") rescue nil
if shGetKnownFolderPath && coTaskMemFree
path="\0"*4
ret=shGetKnownFolderPath.call(packedGuid,0,0,path)
path=path.unpack("V")[0]
ret=getUnicodeString(path)
coTaskMemFree.call(path)
return ret
end
return ""
end
|
#getLastColors(colorstack, opacitystack, defaultcolors) ⇒ Object
406
407
408
409
410
411
412
413
414
415
416
|
# File 'scripts/DrawText.rb', line 406
def getLastColors(colorstack,opacitystack,defaultcolors)
colors=getLastParam(colorstack,defaultcolors)
opacity=getLastParam(opacitystack,255)
if opacity!=255
colors=[Color.new(colors[0].red,colors[0].green,colors[0].blue,
colors[0].alpha*opacity/255),
colors[1] ? Color.new(colors[1].red,colors[1].green,colors[1].blue,
colors[1].alpha*opacity/255) : nil]
end
return colors
end
|
#getLastParam(array, default) ⇒ Object
199
200
201
202
203
204
205
206
|
# File 'scripts/DrawText.rb', line 199
def getLastParam(array,default)
i=array.length-1
while i>=0
return array[i] if array[i]
i-=1
end
return default
end
|
#getLineBrokenChunks(bitmap, value, width, dims, plain = false) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'scripts/DrawText.rb', line 1
def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
x=0
y=0
textheight=0
ret=[]
if dims
dims[0]=0
dims[1]=0
end
re=/<c=([^>]+)>/
reNoMatch=/<c=[^>]+>/
return ret if !bitmap || bitmap.disposed? || width<=0
textmsg=value.clone
lines=0
color=Font.default_color
while (c = textmsg.slice!(/\n|\S*\-+|(\S*([ \r\t\f]?))/)) != nil
break if c==""
ccheck=c
if ccheck=="\n"
x=0
y+=(textheight==0) ? bitmap.text_size("X").height : textheight
textheight=0
next
end
if ccheck[/</] && !plain
textcols=[]
ccheck.scan(re){ textcols.push(rgbToColor($1)) }
words=ccheck.split(reNoMatch) else
textcols=[]
words=[ccheck]
end
for i in 0...words.length
word=words[i]
if word && word!=""
textSize=bitmap.text_size(word)
textwidth=textSize.width
if x>0 && x+textwidth>=width-2
x=0
y+=32 textheight=0
end
textheight=32 ret.push([word,x,y,textwidth,textheight,color])
x+=textwidth
dims[0]=x if dims && dims[0]<x
end
if textcols[i]
color=textcols[i]
end
end
end
dims[1]=y+textheight if dims
return ret
end
|
#getLineBrokenText(bitmap, value, width, dims) ⇒ Object
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
# File 'scripts/TextEntry.rb', line 301
def getLineBrokenText(bitmap,value,width,dims)
x=0
y=0
textheight=0
ret=[]
if dims
dims[0]=0
dims[1]=0
end
line=0
position=0
column=0
return ret if !bitmap || bitmap.disposed? || width<=0
textmsg=value.clone
lines=0
color=Font.default_color
ret.push(["",0,0,0,bitmap.text_size("X").height,0,0,0,0])
while ((c = textmsg.slice!(/\n|(\S*([ \r\t\f]?))/)) != nil)
break if c==""
length=c.scan(/./m).length
ccheck=c
if ccheck=="\n"
ret.push(["\n",x,y,0,textheight,line,position,column,0])
x=0
y+=(textheight==0) ? bitmap.text_size("X").height : textheight
line+=1
textheight=0
column=0
position+=length
ret.push(["",x,y,0,textheight,line,position,column,0])
next
end
textcols=[]
words=[ccheck]
for i in 0...words.length
word=words[i]
if word && word!=""
textSize=bitmap.text_size(word)
textwidth=textSize.width
if x>0 && x+textwidth>=width-2
ret.push(["",x,y,0,textheight,line,position,column,0])
x=0
column=0
y+=(textheight==0) ? bitmap.text_size("X").height : textheight
line+=1
textheight=0
end
textheight=[textheight,textSize.height].max
ret.push([word,x,y,textwidth,textheight,line,position,column,length])
x+=textwidth
dims[0]=x if dims && dims[0]<x
end
if textcols[i]
color=textcols[i]
end
end
position+=length
column+=length
end
dims[1]=y+textheight if dims
return ret
end
|
#getMapNameList ⇒ Object
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
|
# File 'scripts/Editor.rb', line 3370
def getMapNameList
pbRgssOpen("Data/townmap.dat","rb"){|f|
@mapdata=Marshal.load(f)
}
ret=[]
for i in 0...@mapdata.length
next if !@mapdata[i]
ret.push(
[i,pbGetMessage(MessageTypes::RegionNames,i)]
)
end
return ret
end
|
#getPassabilityMinimap(mapid) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'scripts/Tilemap_Perspective.rb', line 23
def getPassabilityMinimap(mapid)
map=load_data(sprintf("Data/Map%03d.rxdata",mapid))
tileset=$data_tilesets[map.tileset_id]
minimap=AnimatedBitmap.new("Graphics/Pictures/minimap_tiles")
ret=Bitmap.new(map.width*6,map.height*6)
passtable=Table.new(map.width,map.height)
passages=tileset.passages
for i in 0...map.width
for j in 0...map.height
pass=true
for z in [2,1,0]
if !passable?(passages,map.data[i,j,z])
pass=false
break
end
end
passtable[i,j]=pass ? 1 : 0
end
end
neighbors=TileDrawingHelper::NeighborsToTiles
for i in 0...map.width
for j in 0...map.height
if passtable[i,j]==0
nb=TileDrawingHelper.tableNeighbors(passtable,i,j)
tile=neighbors[nb]
bltMinimapAutotile(ret,i*6,j*6,minimap.bitmap,tile)
end
end
end
minimap.disposes
return ret
end
|
#getSkinColor(windowskin, color, isDarkSkin) ⇒ Object
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
|
# File 'scripts/Messages.rb', line 1119
def getSkinColor(windowskin,color,isDarkSkin)
if !windowskin || windowskin.disposed? ||
windowskin.width!=128 || windowskin.height!=128
textcolors=[
isDarkSkin ? shadowc3tag(MessageConfig::LIGHTTEXTBASE, MessageConfig::LIGHTTEXTSHADOW) :
shadowc3tag(MessageConfig::DARKTEXTBASE, MessageConfig::DARKTEXTSHADOW),
"<c2=7E105D08>", "<c2=421F2117>", "<c2=43F022E8>", "<c2=7FF05EE8>", "<c2=7E1F5D17>", "<c2=43FF22F7>", "<c2=63184210>", "<c2=7FFF5EF7>" ]
color=0 if color>textcolors.length
return textcolors[color]
else color=0 if color>=32
x = 64 + (color % 8) * 8
y = 96 + (color / 8) * 8
pixel=windowskin.get_pixel(x, y)
return shadowctagFromColor(pixel)
end
end
|
#getSpriteCenter(sprite) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 25
def getSpriteCenter(sprite)
return [0,0] if !sprite || sprite.disposed?
return [sprite.x,sprite.y] if !sprite.bitmap || sprite.bitmap.disposed?
centerX=sprite.src_rect.width/2
centerY=sprite.src_rect.height/2
offsetX=(centerX-sprite.ox)*sprite.zoom_x
offsetY=(centerY-sprite.oy)*sprite.zoom_y
return [sprite.x+offsetX,sprite.y+offsetY]
end
|
#getTypes(species) ⇒ Object
1045
1046
1047
1048
1049
1050
1051
1052
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1045
def getTypes(species)
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,species,8)
type1=dexdata.fgetb
type2=dexdata.fgetb
dexdata.close
return type1==type2 ? [type1] : [type1,type2]
end
|
#getUnicodeString(addr) ⇒ Object
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
|
# File 'scripts/SpriteWindow.rb', line 411
def getUnicodeString(addr)
return "" if addr==0
rtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
ret=""
data="xx"
index=(addr.is_a?(String)) ? 0 : addr
loop do
if addr.is_a?(String)
data=addr[index,2]
else
rtlMoveMemory_pi.call(data, index, 2)
end
codepoint=data.unpack("v")[0]
break if codepoint==0
index+=2
if codepoint<=0x7F
ret+=codepoint.chr
elsif codepoint<=0x7FF
ret+=(0xC0|((codepoint>>6)&0x1F)).chr
ret+=(0x80|(codepoint &0x3F)).chr
elsif codepoint<=0xFFFF
ret+=(0xE0|((codepoint>>12)&0x0F)).chr
ret+=(0x80|((codepoint>>6)&0x3F)).chr
ret+=(0x80|(codepoint &0x3F)).chr
elsif codepoint<=0x10FFFF
ret+=(0xF0|((codepoint>>18)&0x07)).chr
ret+=(0x80|((codepoint>>12)&0x3F)).chr
ret+=(0x80|((codepoint>>6)&0x3F)).chr
ret+=(0x80|(codepoint &0x3F)).chr
end
end
return ret
end
|
#getUnicodeStringFromAnsi(addr) ⇒ Object
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
# File 'scripts/SpriteWindow.rb', line 385
def getUnicodeStringFromAnsi(addr)
return "" if addr==0
rtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
ret=""
data="x"
index=(addr.is_a?(String)) ? 0 : addr
loop do
if addr.is_a?(String)
data=addr[index,1]
else
rtlMoveMemory_pi.call(data, index, 1)
end
index+=1
codepoint=data.unpack("C")[0]
break if codepoint==0 || !codepoint
break if codepoint==0
if codepoint<=0x7F
ret+=codepoint.chr
else
ret+=(0xC0|((codepoint>>6)&0x1F)).chr
ret+=(0x80|(codepoint &0x3F)).chr
end
end
return ret
end
|
#hasMorePowerfulMove(moves, thismove) ⇒ Object
305
306
307
308
309
310
311
312
313
314
315
316
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 305
def hasMorePowerfulMove(moves,thismove)
thisdata=moveData(thismove)
return false if thisdata.basedamage==0
for move in moves
next if move==0
if moveData(move).type==thisdata.type &&
moveData(move).basedamage>thisdata.basedamage
return true
end
end
return false
end
|
#intSize(value) ⇒ Object
605
606
607
608
609
610
611
|
# File 'scripts/Compiler.rb', line 605
def intSize(value)
return 1 if value<0x80
return 2 if value<0x4000
return 3 if value<0x200000
return 4 if value<0x10000000
return 5
end
|
#isBattlePokemonDuplicate(pk, pk2) ⇒ Object
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1248
def isBattlePokemonDuplicate(pk,pk2)
if pk.species==pk2.species
moves1=[]
moves2=[]
4.times{
moves1.push(pk.moves[0].id)
moves2.push(pk.moves[1].id)
}
moves1.sort!
moves2.sort!
if moves1[0]==moves2[0] &&
moves1[1]==moves2[1] &&
moves1[2]==moves2[2] &&
moves1[3]==moves2[3]
return true if moves1[3]!=0
end
return true if pk.item==pk2.item &&
pk.nature==pk2.nature &&
pk.ev[0]==pk2.ev[0] &&
pk.ev[1]==pk2.ev[1] &&
pk.ev[2]==pk2.ev[2] &&
pk.ev[3]==pk2.ev[3] &&
pk.ev[4]==pk2.ev[4] &&
pk.ev[5]==pk2.ev[5]
return false
end
end
|
#isDarkBackground(background, rect = nil) ⇒ Object
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
|
# File 'scripts/SpriteWindow.rb', line 1028
def isDarkBackground(background,rect=nil)
if !background || background.disposed?
return true
end
rect=background.rect if !rect
if rect.width<=0 || rect.height<=0
return true
end
xSeg=(rect.width/16)
xLoop=(xSeg==0) ? 1 : 16
xStart=(xSeg==0) ? rect.x+(rect.width/2) : rect.x+xSeg/2
ySeg=(rect.height/16)
yLoop=(ySeg==0) ? 1 : 16
yStart=(ySeg==0) ? rect.y+(rect.height/2) : rect.y+ySeg/2
count=0
y=yStart
r=0; g=0; b=0
yLoop.times {
x=xStart
xLoop.times {
clr=background.get_pixel(x,y)
if clr.alpha!=0
r+=clr.red; g+=clr.green; b+=clr.blue
count+=1
end
x+=xSeg
}
y+=ySeg
}
return true if count==0
r/=count
g/=count
b/=count
return (r*0.299+g*0.587+b*0.114)<128
end
|
#isDarkWindowskin(windowskin) ⇒ Object
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
|
# File 'scripts/SpriteWindow.rb', line 1064
def isDarkWindowskin(windowskin)
if !windowskin || windowskin.disposed?
return true
end
if windowskin.width==192 && windowskin.height==128
return isDarkBackground(windowskin,Rect.new(0,0,128,128))
elsif windowskin.width==128 && windowskin.height==128
return isDarkBackground(windowskin,Rect.new(0,0,64,64))
else
clr=windowskin.get_pixel(windowskin.width/2, windowskin.height/2)
return (clr.red*0.299+clr.green*0.587+clr.blue*0.114)<128
end
end
|
#isLikelyCounter?(thisEvent, otherEvent, mapID, mapdata) ⇒ Boolean
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
|
# File 'scripts/Compiler.rb', line 3188
def isLikelyCounter?(thisEvent,otherEvent,mapID,mapdata)
yonderX=otherEvent.x+(otherEvent.x-thisEvent.x)
yonderY=otherEvent.y+(otherEvent.y-thisEvent.y)
return true if mapdata.isCounterTile?(mapID,otherEvent.x,otherEvent.y)
return thisEvent.pages[0].graphic.character_name!="" &&
otherEvent.pages[0].graphic.character_name=="" &&
otherEvent.pages[0].trigger==0 &&
mapdata.isPassable?(mapID,thisEvent.x,thisEvent.y) &&
!mapdata.isPassable?(mapID,otherEvent.x,otherEvent.y) &&
mapdata.isPassable?(mapID,yonderX,yonderY)
end
|
#isLikelyPassage?(thisEvent, mapID, mapdata) ⇒ Boolean
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
|
# File 'scripts/Compiler.rb', line 3201
def isLikelyPassage?(thisEvent,mapID,mapdata)
return false if !thisEvent || thisEvent.pages.length==0
return false if thisEvent.pages.length!=1
if thisEvent.pages[0].graphic.character_name=="" &&
thisEvent.pages[0].list.length<=12 &&
thisEvent.pages[0].list.any? {|cmd| cmd.code==201 } &&
mapdata.isPassable?(mapID,thisEvent.x,thisEvent.y) &&
!mapdata.isPassable?(mapID,thisEvent.x-1,thisEvent.y) &&
!mapdata.isPassable?(mapID,thisEvent.x+1,thisEvent.y) &&
!mapdata.isPassable?(mapID,thisEvent.x-1,thisEvent.y-1) &&
!mapdata.isPassable?(mapID,thisEvent.x+1,thisEvent.y-1)
return true
end
return false
end
|
#isPlainEvent?(event) ⇒ Boolean
3147
3148
3149
3150
3151
3152
3153
3154
3155
|
# File 'scripts/Compiler.rb', line 3147
def isPlainEvent?(event)
return event && event.pages.length<=1 &&
event.pages[0].list.length<=1 &&
event.pages[0].move_type==0 &&
event.pages[0].condition.switch1_valid==false &&
event.pages[0].condition.switch2_valid==false &&
event.pages[0].condition.variable_valid==false &&
event.pages[0].condition.self_switch_valid==false
end
|
#isPlainEventOrMart?(event) ⇒ Boolean
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
|
# File 'scripts/Compiler.rb', line 3157
def isPlainEventOrMart?(event)
return event &&
event.pages.length<=1 &&
event.pages[0].move_type==0 &&
event.pages[0].condition.switch1_valid==false &&
event.pages[0].condition.switch2_valid==false &&
event.pages[0].condition.variable_valid==false &&
event.pages[0].condition.self_switch_valid==false &&
((event.pages[0].list.length<=1) || (
event.pages[0].list.length<=12 &&
event.pages[0].graphic.character_name!="" &&
event.pages[0].list[0].code==355 &&
event.pages[0].list[0].parameters[0][/^pbPokemonMart/]) || (
event.pages[0].list.length>8 &&
event.pages[0].graphic.character_name!="" &&
event.pages[0].list[0].code==355 &&
event.pages[0].list[0].parameters[0][/^Kernel\.pbSetPokemonCenter/])
)
end
|
#isReversed(src0, src1, dst0, dst1) ⇒ Object
691
692
693
694
695
696
697
698
699
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 691
def isReversed(src0,src1,dst0,dst1)
if src0==src1
return false
elsif src0<src1
return (dst0>dst1)
else
return (dst0<dst1)
end
end
|
#isWaitChar(x) ⇒ Object
208
209
210
|
# File 'scripts/DrawText.rb', line 208
def isWaitChar(x)
return (x=="\001" || x=="\002")
end
|
#itemIconTag(item) ⇒ Object
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
|
# File 'scripts/Messages.rb', line 1108
def itemIconTag(item)
return "" if !item
if item.respond_to?("icon_name")
return sprintf("<icon=%s>",item.icon_name)
else
ix=item.icon_index % 16 * 24
iy=item.icon_index / 16 * 24
return sprintf("<img=Graphics/System/Iconset|%d|%d|24|24>",ix,iy)
end
end
|
#jumpFancy(follower, direction) ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'scripts/PField_DependentEvents.rb', line 108
def jumpFancy(follower,direction)
deltaX=(direction == 6 ? 2 : (direction == 4 ? -2 : 0))
deltaY=(direction == 2 ? 2 : (direction == 8 ? -2 : 0))
halfDeltaX=(direction == 6 ? 1 : (direction == 4 ? -1 : 0))
halfDeltaY=(direction == 2 ? 1 : (direction == 8 ? -1 : 0))
middle=pbTestPass(follower,follower.x+halfDeltaX,follower.y+halfDeltaY,0)
ending=pbTestPass(follower,follower.x+deltaX, follower.y+deltaY, 0)
if middle
moveFancy(follower,direction)
moveFancy(follower,direction)
elsif ending
if pbTestPass(follower,follower.x,follower.y,0)
follower.jump(deltaX,deltaY)
else
moveThrough(follower,direction)
moveThrough(follower,direction)
end
end
end
|
#loadBase64Anim(s) ⇒ Object
2903
2904
2905
|
# File 'scripts/BattleAnimationEditor.rb', line 2903
def loadBase64Anim(s)
return Marshal.restore(StringInput.new(Zlib::Inflate.inflate(s.unpack("m")[0])))
end
|
#mainFunctionDebug ⇒ Object
#minimumLevel(move) ⇒ Object
167
168
169
170
171
172
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 167
def minimumLevel(move)
if !$minimumLevel[move]
$minimumLevel[move]=pbGetMinimumLevel(move)
end
return $minimumLevel[move]
end
|
#moonphase(time = nil) ⇒ Object
Fases de la Luna y Zodíaco
Determina la fase de la luna. 0 - New Moon - Luna Nueva 1 - Waxing Crescent - Luna Nueva Visible 2 - First Quarter - Cuarto Creciente 3 - Waxing Gibbous - Luna Gibosa Creciente 4 - Full Moon - Luna Llena 5 - Waning Gibbous - Luna Gibosa Menguante 6 - Last Quarter - Cuarto Menguante 7 - Waning Crescent - Luna Menguante
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
# File 'scripts/PField_Time.rb', line 151
def moonphase(time=nil) time=pbGetTimeNow if !time
transitions=[
1.8456618033125,
5.5369854099375,
9.2283090165625,
12.9196326231875,
16.6109562298125,
20.3022798364375,
23.9936034430625,
27.6849270496875]
yy=time.year-((12-time.mon)/10.0).floor
j=(365.25*(4712+yy)).floor + (((time.mon+9)%12)*30.6+0.5).floor + time.day+59
j-=(((yy/100.0)+49).floor*0.75).floor-38 if j>2299160
j+=(((time.hour*60)+time.min*60)+time.sec)/86400.0
v=(j-2451550.1)/29.530588853
v=((v-v.floor)+(v<0 ? 1 : 0))
ag=v*29.53
for i in 0...transitions.length
return i if ag<=transitions[i]
end
return 0
end
|
#moveData(move) ⇒ Object
181
182
183
184
185
186
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 181
def moveData(move)
if !$moveData[move]
$moveData[move]=PBMoveData.new(move)
end
return $moveData[move]
end
|
#moveFancy(follower, direction) ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'scripts/PField_DependentEvents.rb', line 81
def moveFancy(follower,direction)
deltaX=(direction == 6 ? 1 : (direction == 4 ? -1 : 0))
deltaY=(direction == 2 ? 1 : (direction == 8 ? -1 : 0))
newX = follower.x + deltaX
newY = follower.y + deltaY
if ($game_player.x==newX && $game_player.y==newY) ||
pbTestPass(follower,newX,newY,0) ||
!pbTestPass(follower,follower.x,follower.y,0)
oldThrough=follower.through
follower.through=true
case direction
when 2 follower.move_down
when 4 follower.move_left
when 6 follower.move_right
when 8 follower.move_up
end
follower.through=oldThrough
end
end
|
#moveThrough(follower, direction) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'scripts/PField_DependentEvents.rb', line 64
def moveThrough(follower,direction)
oldThrough=follower.through
follower.through=true
case direction
when 2 follower.move_down
when 4 follower.move_left
when 6 follower.move_right
when 8 follower.move_up
end
follower.through=oldThrough
end
|
#normalizeConnectionPoint(conn) ⇒ Object
658
659
660
661
662
663
664
665
666
667
668
669
670
671
|
# File 'scripts/Editor.rb', line 658
def normalizeConnectionPoint(conn)
ret=conn.clone
if conn[1]<0 && conn[4]<0
elsif conn[1]<0 || conn[4]<0
ret[4]=-conn[1]
ret[1]=-conn[4]
end
if conn[2]<0 && conn[5]<0
elsif conn[2]<0 || conn[5]<0
ret[5]=-conn[2]
ret[2]=-conn[5]
end
return ret
end
|
#parseItem(item) ⇒ Object
734
735
736
737
738
739
740
741
|
# File 'scripts/Compiler.rb', line 734
def parseItem(item)
clonitem=item.upcase
clonitem.sub!(/^\s*/){}
clonitem.sub!(/\s*$/){}
return pbGetConst(PBItems,clonitem,
_INTL("Nombre de constante de objeto indefinido: %s\r\nEl nombre sólo consiste en letras, números y\r\nguiones bajos y no puede iniciar con un número.\r\nAsegúrate de que el objeto está definido en\r\nPBS/items.txt.\r\n{1}",
FileLineData.linereport))
end
|
#parseMove(item) ⇒ Object
752
753
754
755
756
757
|
# File 'scripts/Compiler.rb', line 752
def parseMove(item)
clonitem=item.upcase
clonitem.sub!(/^\s*/){}
clonitem.sub!(/\s*$/){}
return pbGetConst(PBMoves,clonitem,_INTL("Nombre de constante de movimiento indefinido: %s\r\nEl nombre sólo consiste en letras, números y\r\nguiones bajos y no puede iniciar con un número.\r\nAsegúrate de que el objeto está definido en\r\nPBS/moves.txt.\r\n{1}",FileLineData.linereport))
end
|
#parseNature(item) ⇒ Object
759
760
761
762
763
764
|
# File 'scripts/Compiler.rb', line 759
def parseNature(item)
clonitem=item.upcase
clonitem.sub!(/^\s*/){}
clonitem.sub!(/\s*$/){}
return pbGetConst(PBNatures,clonitem,_INTL("Nombre de constante de naturaleza indefinido: %s\r\nEl nombre sólo consiste en letras, números y\r\nguiones bajos y no puede iniciar con un número.\r\nAsegúrate de que el objeto está definido en\r\nla sección del script PBNatures.\r\n{1}",FileLineData.linereport))
end
|
#parseSpecies(item) ⇒ Object
743
744
745
746
747
748
749
750
|
# File 'scripts/Compiler.rb', line 743
def parseSpecies(item)
clonitem=item.upcase
clonitem.gsub!(/^[\s\n]*/){}
clonitem.gsub!(/[\s\n]*$/){}
clonitem="NIDORANmA" if clonitem=="NIDORANMA"
clonitem="NIDORANfE" if clonitem=="NIDORANFE"
return pbGetConst(PBSpecies,clonitem,_INTL("Nombre de constante de especie indefinido: [%s]\r\nEl nombre sólo consiste en letras, números y\r\nguiones bajos y no puede iniciar con un número.\r\nAsegúrate de que el objeto está definido en\r\nPBS/pokemon.txt.\r\n{1}",FileLineData.linereport))
end
|
#parseTrainer(item) ⇒ Object
766
767
768
769
770
771
|
# File 'scripts/Compiler.rb', line 766
def parseTrainer(item)
clonitem=item.clone
clonitem.sub!(/^\s*/){}
clonitem.sub!(/\s*$/){}
return pbGetConst(PBTrainers,clonitem,_INTL("Nombre de constante de Entrenador indefinido: %s\r\nEl nombre sólo consiste en letras, números y\r\nguiones bajos y no puede iniciar con un número.\r\nAsegúrate de que el objeto está definido en\r\ntrainertypes.txt.\r\n{1}",FileLineData.linereport))
end
|
#passable?(passages, tile_id) ⇒ Boolean
17
18
19
20
21
|
# File 'scripts/Tilemap_Perspective.rb', line 17
def passable?(passages,tile_id)
return false if tile_id == nil
return false if passages[tile_id] == nil
return (passages[tile_id]<15)
end
|
#pbActivateWindow(sprites, key) ⇒ Object
Activates a specific window of a sprite hash. key is the key of the window in the sprite hash. If a code block is given, deactivates all windows except the specified window, runs the code in the block, and reactivates them.
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
|
# File 'scripts/SpriteWindow.rb', line 1319
def pbActivateWindow(sprites,key)
return if !sprites
activeStatuses={}
for i in sprites
if i[1] && i[1].is_a?(Window) && !pbDisposed?(i[1])
activeStatuses[i[0]]=i[1].active
i[1].active=(i[0]==key)
end
end
if block_given?
begin
yield
ensure
pbRestoreActivations(sprites,activeStatuses)
end
return {}
else
return activeStatuses
end
end
|
#pbAddDependency(event) ⇒ Object
17
18
19
|
# File 'scripts/PField_DependentEvents.rb', line 17
def pbAddDependency(event)
$PokemonTemp.dependentEvents.addEvent(event)
end
|
#pbAddDependency2(eventID, eventName, commonEvent) ⇒ Object
25
26
27
|
# File 'scripts/PField_DependentEvents.rb', line 25
def pbAddDependency2(eventID, eventName, commonEvent)
$PokemonTemp.dependentEvents.addEvent($game_map.events[eventID],eventName,commonEvent)
end
|
#pbAddPassageList(event, mapdata) ⇒ Object
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
|
# File 'scripts/Compiler.rb', line 3252
def pbAddPassageList(event,mapdata)
return if !event || event.pages.length==0
page=RPG::Event::Page.new
page.condition.switch1_valid=true
page.condition.switch1_id=mapdata.registerSwitch('s:tsOff?("A")')
page.graphic.character_name=""
page.trigger=3 page.list.clear
list=page.list
pbPushBranch(list,"get_character(0).onEvent?")
pbPushEvent(list,208,[0],1)
pbPushWait(list,6,1)
pbPushEvent(list,208,[1],1)
pbPushMoveRouteAndWait(list,-1,[PBMoveRoute::Down],1)
pbPushBranchEnd(list,1)
pbPushScript(list,"setTempSwitchOn(\"A\")")
pbPushEnd(list)
event.pages.push(page)
end
|
#pbAddRgssScriptTexts(items, script) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'scripts/Intl_Messages.rb', line 10
def pbAddRgssScriptTexts(items,script)
script.scan(/(?:_INTL|_ISPRINTF)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/){|s|
string=s[0]
string.gsub!(/\\r/,"\r")
string.gsub!(/\\n/,"\n")
string.gsub!(/\\1/,"\1")
string.gsub!(/\\\"/,"\"")
string.gsub!(/\\\\/,"\\")
items.push(string)
}
end
|
#pbAddScript(script, sectionname) ⇒ Object
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
|
# File 'scripts/Compiler.rb', line 784
def pbAddScript(script,sectionname)
begin
scripts=load_data("Data/Constants.rxdata")
scripts=[] if !scripts
rescue
scripts=[]
end
s=pbFindScript(scripts,sectionname)
if s
s[2]=Zlib::Deflate.deflate("#{script}\r\n")
else
scripts.push([rand(100000000),sectionname,Zlib::Deflate.deflate("#{script}\r\n")])
end
save_data(scripts,"Data/Constants.rxdata")
end
|
#pbAddScriptTexts(items, script) ⇒ Object
1
2
3
4
5
6
7
8
|
# File 'scripts/Intl_Messages.rb', line 1
def pbAddScriptTexts(items,script)
script.scan(/(?:_I)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/){|s|
string=s[0]
string.gsub!(/\\\"/,"\"")
string.gsub!(/\\\\/,"\\")
items.push(string)
}
end
|
#pbAlphaBlend(dstColor, srcColor) ⇒ Object
1340
1341
1342
1343
1344
1345
1346
|
# File 'scripts/SpriteWindow.rb', line 1340
def pbAlphaBlend(dstColor,srcColor)
r=(255*(srcColor.red-dstColor.red)/255)+dstColor.red
g=(255*(srcColor.green-dstColor.green)/255)+dstColor.green
b=(255*(srcColor.blue-dstColor.blue)/255)+dstColor.blue
a=(255*(srcColor.alpha-dstColor.alpha)/255)+dstColor.alpha
return Color.new(r,g,b,a)
end
|
#pbAnimationEditor ⇒ Object
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
|
# File 'scripts/BattleAnimationEditor.rb', line 3733
def pbAnimationEditor
pbBGMStop()
animation=tryLoadData("Data/PkmnAnimations.rxdata")
if !animation || !animation[0]
animation=PBAnimations.new
animation[0].graphic=""
end
oldsize=Win32API.client_size
Win32API.SetWindowPos((512+288)*$ResizeFactor,(384+288)*$ResizeFactor)
animationEditorMain(animation)
Win32API.SetWindowPos(oldsize[0],oldsize[1])
$game_map.autoplay if $game_map
end
|
#pbAnimationsOrganiser ⇒ Object
Debug option for rearranging animations
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
|
# File 'scripts/BattleAnimationEditor.rb', line 3750
def pbAnimationsOrganiser
list=tryLoadData("Data/PkmnAnimations.rxdata")
if !list || !list[0]
Kernel.pbMessage(_INTL("No animations exist."))
return
end
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
cmdwin=pbListWindow([],256)
cmdwin.viewport=viewport
cmdwin.z=2
title=Window_UnformattedTextPokemon.new(_INTL("Animations Organiser"))
title.x=256
title.y=0
title.width=Graphics.width-256
title.height=64
title.viewport=viewport
title.z=2
info=Window_AdvancedTextPokemon.new(_INTL("Z+Up/Down: Swap\nZ+Left: Delete\nZ+Right: Insert"))
info.x=256
info.y=64
info.width=Graphics.width-256
info.height=Graphics.height-64
info.viewport=viewport
info.z=2
commands=[]
refreshlist=true; oldsel=-1
cmd=[0,0]
loop do
if refreshlist
commands=[]
for i in 0...list.length
commands.push(sprintf("%d: %s",i,list[i] ? list[i].name : "???"))
end
end
refreshlist=false; oldsel=-1
cmd=pbCommands3(cmdwin,commands,-1,cmd[1],true)
if cmd[0]==1 if cmd[1]>=0 && cmd[1]<commands.length-1
list[cmd[1]+1],list[cmd[1]]=list[cmd[1]],list[cmd[1]+1]
refreshlist=true
end
elsif cmd[0]==2 if cmd[1]>0
list[cmd[1]-1],list[cmd[1]]=list[cmd[1]],list[cmd[1]-1]
refreshlist=true
end
elsif cmd[0]==3 list[cmd[1]]=nil
list.compact
cmd[1]=[cmd[1],list.length-1].min
refreshlist=true
pbWait(5)
elsif cmd[0]==4 list[list.length]=PBAnimation.new
i=list.length-1
loop do break unless i>cmd[1]
list[i],list[i-1]=list[i-1],list[i]
i-=1
end
refreshlist=true
elsif cmd[0]==0
cmd2=Kernel.pbMessage(_INTL("Save changes?"),
[_INTL("Sí"),_INTL("No"),_INTL("Salir")],3)
if cmd2==0 || cmd2==1
if cmd2==0
save_data(list,"Data/PkmnAnimations.rxdata")
Kernel.pbMessage(_INTL("Data saved."))
end
break
end
end
end
title.dispose
info.dispose
cmdwin.dispose
viewport.dispose
end
|
#pbAnimList(animations, canvas, animwin) ⇒ Object
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
|
# File 'scripts/BattleAnimationEditor.rb', line 2817
def pbAnimList(animations,canvas,animwin)
commands=[]
for i in 0...animations.length
animations[i]=PBAnimation.new if !animations[i]
commands[commands.length]=_INTL("{1} {2}",i,animations[i].name)
end
cmdwin=pbListWindow(commands,320)
cmdwin.height=416
cmdwin.opacity=224
cmdwin.index=animations.selected
cmdwin.viewport=canvas.viewport
helpwindow=Window_UnformattedTextPokemon.newWithSize(
_INTL("C: Load/rename an animation\nEsc: Cancel"),
320,0,320,128,canvas.viewport)
maxsizewindow=ControlWindow.new(0,416,320,32*3)
maxsizewindow.addSlider(_INTL("Total Animations:"),1,2000,animations.length)
maxsizewindow.addButton(_INTL("Resize Animation List"))
maxsizewindow.opacity=224
maxsizewindow.viewport=canvas.viewport
loop do
Graphics.update
Input.update
cmdwin.update
maxsizewindow.update
helpwindow.update
if maxsizewindow.changed?(1)
newsize=maxsizewindow.value(0)
animations.resize(newsize)
commands.clear
for i in 0...animations.length
commands[commands.length]=_INTL("{1} {2}",i,animations[i].name)
end
cmdwin.commands=commands
cmdwin.index=animations.selected
next
end
if (Input.trigger?(Input::C) || (cmdwin.doubleclick? rescue false)) && animations.length>0
cmd2=Kernel.pbShowCommands(helpwindow,[
_INTL("Load Animation"),
_INTL("Rename"),
_INTL("Delete")
],-1)
if cmd2==0 canvas.loadAnimation(animations[cmdwin.index])
animwin.animbitmap=canvas.animbitmap
animations.selected=cmdwin.index
break
elsif cmd2==1 pbAnimName(animations[cmdwin.index],cmdwin)
cmdwin.refresh
elsif cmd2==2 if Kernel.pbConfirmMessage(_INTL("Are you sure you want to delete this animation?"))
animations[cmdwin.index]=PBAnimation.new
cmdwin.commands[cmdwin.index]=_INTL("{1} {2}",cmdwin.index,animations[cmdwin.index].name)
cmdwin.refresh
end
end
end
if Input.trigger?(Input::B)
break
end
end
helpwindow.dispose
maxsizewindow.dispose
cmdwin.dispose
end
|
#pbAnimName(animation, cmdwin) ⇒ Object
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
|
# File 'scripts/BattleAnimationEditor.rb', line 2793
def pbAnimName(animation,cmdwin)
window=ControlWindow.new(320,128,320,32*4)
window.z=99999
window.addControl(TextField.new(_INTL("Nombre Nuevo:"),animation.name))
okbutton=window.addButton(_INTL("Aceptar"))
cancelbutton=window.addButton(_INTL("Salir"))
window.opacity=224
loop do
Graphics.update
Input.update
window.update
if window.changed?(okbutton) || Input.triggerex?(0x0D)
cmdwin.commands[cmdwin.index]=_INTL("{1} {2}",cmdwin.index,window.controls[0].text)
animation.name=window.controls[0].text
break
end
if window.changed?(cancelbutton) || Input.triggerex?(0x1B)
break
end
end
window.dispose
return
end
|
#pbApplyEVGain(pokemon, ev, evgain) ⇒ Object
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 305
def pbApplyEVGain(pokemon,ev,evgain)
totalev=0
for i in 0...6
totalev+=pokemon.ev[i]
end
if totalev+evgain>PokeBattle_Pokemon::EVLIMIT evgain-=totalev+evgain-PokeBattle_Pokemon::EVLIMIT
end
if pokemon.ev[ev]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
evgain-=totalev+evgain-PokeBattle_Pokemon::EVSTATLIMIT
end
if evgain>0
pokemon.ev[ev]+=evgain
end
end
|
#pbArrangeByTier(pokemonlist, rule) ⇒ Object
The Pokemon list is already roughly arranged by rank from weakest to strongest
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 258
def pbArrangeByTier(pokemonlist,rule)
tiers=[
withRestr(rule,0,500,0),
withRestr(rule,380,500,0),
withRestr(rule,400,555,0),
withRestr(rule,400,555,0),
withRestr(rule,400,555,0),
withRestr(rule,400,555,0),
withRestr(rule,580,680,1),
withRestr(rule,500,680,0),
withRestr(rule,580,680,2)
]
tierPokemon=[]
for i in 0...tiers.length
tierPokemon.push([])
end
for i in 0...pokemonlist.length
next if !rule.ruleset.isPokemonValid?(pokemonlist[i])
validtiers=[]
for j in 0...tiers.length
tier=tiers[j]
if tier.ruleset.isPokemonValid?(pokemonlist[i])
validtiers.push(j)
end
end
if validtiers.length>0
vt=validtiers.length*i/pokemonlist.length
tierPokemon[validtiers[vt]].push(pokemonlist[i])
end
end
ret=[]
for i in 0...tiers.length
tierPokemon[i].sort!{|a,b|
bstA=baseStatTotal(a.species)
bstB=baseStatTotal(b.species)
if bstA==bstB
a.species<=>b.species
else
bstA<=>bstB
end
}
ret.concat(tierPokemon[i])
end
return ret
end
|
#pbAutoplayOnSave ⇒ Object
2005
2006
2007
2008
2009
2010
2011
2012
|
# File 'scripts/PField_Field.rb', line 2005
def pbAutoplayOnSave
surfbgm=pbGetMetadata(0,MetadataSurfBGM)
if $PokemonGlobal.surfing && surfbgm
pbBGMPlay(surfbgm)
else
$game_map.autoplay
end
end
|
#pbAutoplayOnTransition ⇒ Object
1996
1997
1998
1999
2000
2001
2002
2003
|
# File 'scripts/PField_Field.rb', line 1996
def pbAutoplayOnTransition
surfbgm=pbGetMetadata(0,MetadataSurfBGM)
if $PokemonGlobal.surfing && surfbgm
pbBGMPlay(surfbgm)
else
$game_map.autoplayAsCue
end
end
|
#pbBalancedLevelFromBST(species) ⇒ Object
14
15
16
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 14
def pbBalancedLevelFromBST(species)
return (113-(pbBaseStatTotal(species)*0.072)).round
end
|
#pbBallTypeToBall(balltype) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'scripts/PItem_PokeBalls.rb', line 30
def pbBallTypeToBall(balltype)
if $BallTypes[balltype]
ret=getID(PBItems,$BallTypes[balltype])
return ret if ret!=0
end
if $BallTypes[0]
ret=getID(PBItems,$BallTypes[0])
return ret if ret!=0
end
return getID(PBItems,:POKEBALL)
end
|
#pbBaseStatTotal(species) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 1
def pbBaseStatTotal(species)
dexdata=pbOpenDexData()
pbDexDataOffset(dexdata,species,10)
bst=dexdata.fgetb
bst+=dexdata.fgetb
bst+=dexdata.fgetb
bst+=dexdata.fgetb
bst+=dexdata.fgetb
bst+=dexdata.fgetb
dexdata.close()
return bst
end
|
#pbBatteryLow? ⇒ Boolean
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
|
# File 'scripts/PField_Field.rb', line 1931
def pbBatteryLow?
power="\0"*12
begin
sps=Win32API.new('kernel32.dll','GetSystemPowerStatus','p','l')
rescue
return false
end
if sps.call(power)==1
status=power.unpack("CCCCVV")
if status[1]!=255 && (status[1]&6)!=0 return true
end
if status[2]<3 return true
end
if status[4]<300 return true
end
end
return false
end
|
#pbBattleAnimation(bgm = nil, trainerid = -1,, trainername = "") ⇒ Object
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
# File 'scripts/PField_Field.rb', line 485
def pbBattleAnimation(bgm=nil,trainerid=-1,trainername="")
handled=false
playingBGS=nil
playingBGM=nil
if $game_system && $game_system.is_a?(Game_System)
playingBGS=$game_system.getPlayingBGS
playingBGM=$game_system.getPlayingBGM
$game_system.bgm_pause
$game_system.bgs_pause
end
pbMEFade(0.25)
pbWait(10)
pbMEStop
if bgm
pbBGMPlay(bgm)
else
pbBGMPlay(pbGetWildBattleBGM(0))
end
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
viewport.color=Color.new(17*8,17*8,17*8)
3.times do
viewport.color.alpha=0
6.times do
viewport.color.alpha+=30
Graphics.update
Input.update
pbUpdateSceneMap
end
6.times do
viewport.color.alpha-=30
Graphics.update
Input.update
pbUpdateSceneMap
end
end
if $game_temp.background_bitmap
$game_temp.background_bitmap.dispose
end
$game_temp.background_bitmap=Graphics.snap_to_bitmap
handled=pbBattleAnimationOverride(viewport,trainerid,trainername)
if !handled
if Sprite.method_defined?(:wave_amp) && rand(15)==0
viewport.color=Color.new(0,0,0,255)
sprite = Sprite.new
bitmap=Graphics.snap_to_bitmap
bm=bitmap.clone
sprite.z=99999
sprite.bitmap = bm
sprite.wave_speed=500
for i in 0..25
sprite.opacity-=10
sprite.wave_amp+=60
sprite.update
sprite.wave_speed+=30
2.times do
Graphics.update
end
end
bitmap.dispose
bm.dispose
sprite.dispose
elsif Bitmap.method_defined?(:radial_blur) && rand(15)==0
viewport.color=Color.new(0,0,0,255)
sprite = Sprite.new
bitmap=Graphics.snap_to_bitmap
bm=bitmap.clone
sprite.z=99999
sprite.bitmap = bm
for i in 0..15
bm.radial_blur(i,2)
sprite.opacity-=15
2.times do
Graphics.update
end
end
bitmap.dispose
bm.dispose
sprite.dispose
elsif rand(10)==0 scroll=["ScrollDown","ScrollLeft","ScrollRight","ScrollUp",
"ScrollDownRight","ScrollDownLeft","ScrollUpRight","ScrollUpLeft"]
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(50,sprintf("Graphics/Transitions/%s",scroll[rand(scroll.length)]))
else
transitions=[
"021-Normal01","022-Normal02",
"Battle","battle1","battle2","battle3","battle4",
"computertr","computertrclose",
"hexatr","hexatrc","hexatzr",
"Image1","Image2","Image3","Image4",
"Splash","Random_stripe_v","Random_stripe_h",
"RotatingPieces","ShrinkingPieces",
"BreakingGlass","Mosaic","zoomin"
]
rnd=rand(transitions.length)
Graphics.freeze
viewport.color=Color.new(0,0,0,255)
Graphics.transition(40,sprintf("Graphics/Transitions/%s",transitions[rnd]))
end
5.times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
pbPushFade
yield if block_given?
pbPopFade
if $game_system && $game_system.is_a?(Game_System)
$game_system.bgm_resume(playingBGM)
$game_system.bgs_resume(playingBGS)
end
$PokemonGlobal.nextBattleBGM=nil
$PokemonGlobal.nextBattleME=nil
$PokemonGlobal.nextBattleBack=nil
$PokemonEncounters.clearStepCount
for j in 0..17
viewport.color=Color.new(0,0,0,(17-j)*15)
Graphics.update
Input.update
pbUpdateSceneMap
end
viewport.dispose
end
|
#pbBattleAnimationOverride(viewport, trainerid = -1,, trainername = "") ⇒ Object
Alias and use this method if you want to add a custom battle intro animation e.g. variants of the Vs. animation. Note that $game_temp.background_bitmap contains an image of the current game screen. When the custom animation has finished, the screen should have faded to black somehow.
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
|
# File 'scripts/PField_Field.rb', line 623
def pbBattleAnimationOverride(viewport,trainerid=-1,trainername="")
if trainerid>=0
tbargraphic=sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,trainerid)) rescue nil
tbargraphic=sprintf("Graphics/Transitions/vsBar%d",trainerid) if !pbResolveBitmap(tbargraphic)
tgraphic=sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,trainerid)) rescue nil
tgraphic=sprintf("Graphics/Transitions/vsTrainer%d",trainerid) if !pbResolveBitmap(tgraphic)
if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic)
outfit=$Trainer ? $Trainer.outfit : 0
viewplayer=Viewport.new(0,Graphics.height/3,Graphics.width/2,128)
viewplayer.z=viewport.z
viewopp=Viewport.new(Graphics.width/2,Graphics.height/3,Graphics.width/2,128)
viewopp.z=viewport.z
viewvs=Viewport.new(0,0,Graphics.width,Graphics.height)
viewvs.z=viewport.z
xoffset=(Graphics.width/2)/10
xoffset=xoffset.round
xoffset=xoffset*10
fade=Sprite.new(viewport)
fade.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vsFlash")
fade.tone=Tone.new(-255,-255,-255)
fade.opacity=100
overlay=Sprite.new(viewport)
overlay.bitmap=Bitmap.new(Graphics.width,Graphics.height)
pbSetSystemFont(overlay.bitmap)
bar1=Sprite.new(viewplayer)
pbargraphic=sprintf("Graphics/Transitions/vsBar%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
pbargraphic=sprintf("Graphics/Transitions/vsBar%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pbargraphic)
if !pbResolveBitmap(pbargraphic)
pbargraphic=sprintf("Graphics/Transitions/vsBar%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
end
pbargraphic=sprintf("Graphics/Transitions/vsBar%d",$Trainer.trainertype) if !pbResolveBitmap(pbargraphic)
bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)
bar1.x=-xoffset
bar2=Sprite.new(viewopp)
bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)
bar2.x=xoffset
vs=Sprite.new(viewvs)
vs.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vs")
vs.ox=vs.bitmap.width/2
vs.oy=vs.bitmap.height/2
vs.x=Graphics.width/2
vs.y=Graphics.height/1.5
vs.visible=false
flash=Sprite.new(viewvs)
flash.bitmap=BitmapCache.load_bitmap("Graphics/Transitions/vsFlash")
flash.opacity=0
10.times do
bar1.x+=xoffset/10
bar2.x-=xoffset/10
pbWait(1)
end
pbSEPlay("Flash2")
pbSEPlay("Sword2")
flash.opacity=255
bar1.dispose
bar2.dispose
bar1=AnimatedPlane.new(viewplayer)
bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)
player=Sprite.new(viewplayer)
pgraphic=sprintf("Graphics/Transitions/vsTrainer%s_%d",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil
pgraphic=sprintf("Graphics/Transitions/vsTrainer%d_%d",$Trainer.trainertype,outfit) if !pbResolveBitmap(pgraphic)
if !pbResolveBitmap(pgraphic)
pgraphic=sprintf("Graphics/Transitions/vsTrainer%s",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil
end
pgraphic=sprintf("Graphics/Transitions/vsTrainer%d",$Trainer.trainertype) if !pbResolveBitmap(pgraphic)
player.bitmap=BitmapCache.load_bitmap(pgraphic)
player.x=-xoffset
bar2=AnimatedPlane.new(viewopp)
bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)
trainer=Sprite.new(viewopp)
trainer.bitmap=BitmapCache.load_bitmap(tgraphic)
trainer.x=xoffset
trainer.tone=Tone.new(-255,-255,-255)
25.times do
flash.opacity-=51 if flash.opacity>0
bar1.ox-=16
bar2.ox+=16
pbWait(1)
end
11.times do
bar1.ox-=16
bar2.ox+=16
player.x+=xoffset/10
trainer.x-=xoffset/10
pbWait(1)
end
2.times do
bar1.ox-=16
bar2.ox+=16
player.x-=xoffset/20
trainer.x+=xoffset/20
pbWait(1)
end
10.times do
bar1.ox-=16
bar2.ox+=16
pbWait(1)
end
val=2
flash.opacity=255
vs.visible=true
trainer.tone=Tone.new(0,0,0)
textpos=[
[_INTL("{1}",$Trainer.name),Graphics.width/4,(Graphics.height/1.5)+10,2,
Color.new(248,248,248),Color.new(12*6,12*6,12*6)],
[_INTL("{1}",trainername),(Graphics.width/4)+(Graphics.width/2),(Graphics.height/1.5)+10,2,
Color.new(248,248,248),Color.new(12*6,12*6,12*6)]
]
pbDrawTextPositions(overlay.bitmap,textpos)
pbSEPlay("Sword2")
70.times do
bar1.ox-=16
bar2.ox+=16
flash.opacity-=25.5 if flash.opacity>0
vs.x+=val
vs.y-=val
val=2 if vs.x<=(Graphics.width/2)-2
val=-2 if vs.x>=(Graphics.width/2)+2
pbWait(1)
end
30.times do
bar1.ox-=16
bar2.ox+=16
vs.zoom_x+=0.2
vs.zoom_y+=0.2
pbWait(1)
end
flash.tone=Tone.new(-255,-255,-255)
10.times do
bar1.ox-=16
bar2.ox+=16
flash.opacity+=25.5
pbWait(1)
end
player.dispose
trainer.dispose
flash.dispose
vs.dispose
bar1.dispose
bar2.dispose
overlay.dispose
fade.dispose
viewvs.dispose
viewopp.dispose
viewplayer.dispose
viewport.color=Color.new(0,0,0,255)
return true
end
end
return false
end
|
#pbBattleArenaRules(openlevel) ⇒ Object
1421
1422
1423
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 1421
def pbBattleArenaRules(openlevel)
return pbBattleTowerRules(false,openlevel).setBattleType(BattleArena.new)
end
|
#pbBattleChallenge ⇒ Object
704
705
706
707
708
709
|
# File 'scripts/PBattle_OrgBattle.rb', line 704
def pbBattleChallenge
if !$PokemonGlobal.challenge
$PokemonGlobal.challenge=BattleChallenge.new
end
return $PokemonGlobal.challenge
end
|
#pbBattleChallengeBattle ⇒ Object
778
779
780
|
# File 'scripts/PBattle_OrgBattle.rb', line 778
def pbBattleChallengeBattle
return pbBattleChallenge.pbBattle
end
|
#pbBattleChallengeBeginSpeech ⇒ Object
#pbBattleChallengeGraphic(event) ⇒ Object
741
742
743
744
745
746
747
748
749
750
751
752
|
# File 'scripts/PBattle_OrgBattle.rb', line 741
def pbBattleChallengeGraphic(event)
nextTrainer=pbBattleChallenge.nextTrainer
bttrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
filename=pbTrainerCharNameFile((bttrainers[nextTrainer][0] rescue 0))
begin
bitmap=AnimatedBitmap.new("Graphics/Characters/"+filename)
bitmap.dispose
event.character_name=filename
rescue
event.character_name="Red"
end
end
|
#pbBattleChallengeTrainer(numwins, bttrainers) ⇒ Object
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
|
# File 'scripts/PBattle_OrgBattle.rb', line 711
def pbBattleChallengeTrainer(numwins,bttrainers)
table=[
0,5,0,100,
6,6,80,40,
7,12,80,40,
13,13,120,20,
14,19,100,40,
20,20,140,20,
21,26,120,40,
27,27,160,20,
28,33,140,40,
34,34,180,20,
35,40,160,40,
41,41,200,20,
42,47,180,40,
48,48,220,40,
49,-1,200,100
]
for i in 0...table.length/4
if table[i*4]<=numwins
if (table[i*4+1]<0 || table[i*4+1]>=numwins)
offset=((table[i*4+2]*bttrainers.length).floor/300).floor
length=((table[i*4+3]*bttrainers.length).floor/300).floor
return (offset+rand(length)).floor
end
end
end
return 0
end
|
#pbBattleFactoryPokemon(rule, numwins, numswaps, rentals) ⇒ Object
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
|
# File 'scripts/PBattle_OrgBattle.rb', line 850
def pbBattleFactoryPokemon(rule,numwins,numswaps,rentals)
table=nil
btpokemon=pbGetBTPokemon(pbBattleChallenge.currentChallenge)
ivtable=[
0,6,3,6,
7,13,6,9,
14,20,9,12,
21,27,12,15,
28,34,15,21,
35,41,21,31,
42,-1,31,31
]
groups=[
1,14,6,0,
15,21,5,1,
22,28,4,2,
29,35,3,3,
36,42,2,4,
43,-1,1,5
]
if rule.ruleset.suggestedLevel!=100
table=[
0,6,110,199,
7,13,162,266,
14,20,267,371,
21,27,372,467,
28,34,468,563,
35,41,564,659,
42,48,660,755,
49,-1,372,849
]
else table=[
0,6,372,467,
7,13,468,563,
14,20,564,659,
21,27,660,755,
28,34,372,881,
35,41,372,881,
42,48,372,881,
49,-1,372,881
]
end
pokemonNumbers=[0,0]
ivs=[0,0]
ivgroups=[6,0]
for i in 0...table.length/4
if table[i*4]<=numwins
if (table[i*4+1]<0 || table[i*4+1]>=numwins)
pokemonNumbers=[
table[i*4+2]*btpokemon.length/882,
table[i*4+3]*btpokemon.length/882
]
end
end
end
for i in 0...ivtable.length/4
if ivtable[i*4]<=numwins
if (ivtable[i*4+1]<0 || ivtable[i*4+1]>=numwins)
ivs=[ivtable[i*4+2],ivtable[i*4+3]]
end
end
end
for i in 0...groups.length/4
if groups[i*4]<=numswaps
if (groups[i*4+1]<0 || groups[i*4+1]>=numswaps)
ivgroups=[groups[i*4+2],groups[i*4+3]]
end
end
end
party=[]
begin
party.clear
while party.length<6
rnd=pokemonNumbers[0]+rand(pokemonNumbers[1]-pokemonNumbers[0]+1)
rndpoke=btpokemon[rnd]
indvalue=(party.length<ivgroups[0]) ? ivs[0] : ivs[1]
party.push(rndpoke.createPokemon(rule.ruleset.suggestedLevel,indvalue,nil))
end
end until rule.ruleset.isValid?(party)
return party
end
|
#pbBattleFactoryRules(double, openlevel) ⇒ Object
#pbBattleHPItem(pokemon, battler, restorehp, scene) ⇒ Object
350
351
352
353
354
355
356
357
358
359
360
361
|
# File 'scripts/PItem_Items.rb', line 350
def pbBattleHPItem(pokemon,battler,restorehp,scene)
if pokemon.hp<=0 || pokemon.hp==pokemon.totalhp || pokemon.isEgg?
scene.pbDisplay(_INTL("¡Pero no tuvo ningún efecto!"))
return false
else
hpgain=pbItemRestoreHP(pokemon,restorehp)
battler.hp=pokemon.hp if battler
scene.pbRefresh
scene.pbDisplay(_INTL("La salud de {1} ha sido recuperada.",pokemon.name,hpgain))
return true
end
end
|
#pbBattleOnStepTaken ⇒ Object
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
|
# File 'scripts/PField_Field.rb', line 1381
def pbBattleOnStepTaken
if $Trainer.party.length>0
encounterType=$PokemonEncounters.pbEncounterType
if encounterType>=0
if $PokemonEncounters.isEncounterPossibleHere?()
encounter=$PokemonEncounters.pbGenerateEncounter(encounterType)
encounter=EncounterModifier.trigger(encounter)
if $PokemonEncounters.pbCanEncounter?(encounter)
if $PokemonGlobal.partner
encounter2=$PokemonEncounters.pbEncounteredPokemon(encounterType)
pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])
else
pbWildBattle(encounter[0],encounter[1])
end
end
EncounterModifier.triggerEncounterEnd()
end
end
end
end
|
#pbBattlePalaceRules(double, openlevel) ⇒ Object
1417
1418
1419
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 1417
def pbBattlePalaceRules(double,openlevel)
return pbBattleTowerRules(double,openlevel).setBattleType(BattlePalace.new)
end
|
#pbBattleRestorePP(pokemon, battler, move, pp) ⇒ Object
439
440
441
442
443
444
445
|
# File 'scripts/PItem_Items.rb', line 439
def pbBattleRestorePP(pokemon,battler,move,pp)
ret=pbRestorePP(pokemon,move,pp)
if ret>0
battler.pbSetPP(battler.moves[move],pokemon.moves[move].pp) if battler
end
return ret
end
|
#pbBattleTowerRules(double, openlevel) ⇒ Object
#pbBerryPlant ⇒ Object
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
# File 'scripts/PField_BerryPlants.rb', line 298
def pbBerryPlant
interp=pbMapInterpreter
thisEvent=interp.get_character(0)
berryData=interp.getVariable
p berryData if Input.trigger?(Input::CTRL)
if !berryData
if NEWBERRYPLANTS
berryData=[0,0,0,0,0,0,0,0]
else
berryData=[0,0,false,0,0,0]
end
end
case berryData[0]
when 1; thisEvent.turn_down when 2; thisEvent.turn_down when 3; thisEvent.turn_left when 4; thisEvent.turn_right when 5; thisEvent.turn_up end
watering=[]
watering.push(getConst(PBItems,:SPRAYDUCK))
watering.push(getConst(PBItems,:SQUIRTBOTTLE))
watering.push(getConst(PBItems,:WAILMERPAIL))
watering.push(getConst(PBItems,:SPRINKLOTAD))
watering.compact!
berry=berryData[1]
case berryData[0]
when 0 if NEWBERRYPLANTS
if !berryData[7] || berryData[7]==0 cmd=Kernel.pbMessage(_INTL("Es un suelo blando y fértil."),[
_INTL("Fertilizar"),
_INTL("Plantar Baya"),
_INTL("Salir")],-1)
if cmd==0 ret=0
pbFadeOutIn(99999){
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
ret=screen.pbChooseItemScreen
}
if ret>0
if pbIsMulch?(ret)
berryData[7]=ret
Kernel.pbMessage(_INTL("Has esparcido {1} por la tierra.",PBItems.getName(ret)))
if Kernel.pbConfirmMessage(_INTL("¿Quieres plantar una Baya?"))
pbFadeOutIn(99999){
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
berry=screen.pbChooseBerryScreen
}
if berry>0
timenow=pbGetTimeNow
berryData[0]=1 berryData[1]=berry berryData[2]=0 berryData[3]=timenow.to_i berryData[4]=100 berryData[5]=0 berryData[6]=0 $PokemonBag.pbDeleteItem(berry,1)
Kernel.pbMessage(_INTL("La {1} ha sido plantada en el suelo blando y fértil.",
PBItems.getName(berry)))
end
end
interp.setVariable(berryData)
else
Kernel.pbMessage(_INTL("¡Con eso no se fertilizará la tierra!"))
end
return
end
elsif cmd==1 pbFadeOutIn(99999){
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
berry=screen.pbChooseBerryScreen
}
if berry>0
timenow=pbGetTimeNow
berryData[0]=1 berryData[1]=berry berryData[2]=0 berryData[3]=timenow.to_i berryData[4]=100 berryData[5]=0 berryData[6]=0 $PokemonBag.pbDeleteItem(berry,1)
Kernel.pbMessage(_INTL("La {1} ha sido plantada en el suelo blando y fértil.",
PBItems.getName(berry)))
interp.setVariable(berryData)
end
return
end
else
Kernel.pbMessage(_INTL("Hay {1} esparcido por la tierra.",PBItems.getName(berryData[7])))
if Kernel.pbConfirmMessage(_INTL("¿Quieres plantar una Baya?"))
pbFadeOutIn(99999){
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
berry=screen.pbChooseBerryScreen
}
if berry>0
timenow=pbGetTimeNow
berryData[0]=1 berryData[1]=berry berryData[2]=0 berryData[3]=timenow.to_i berryData[4]=100 berryData[5]=0 berryData[6]=0 $PokemonBag.pbDeleteItem(berry,1)
Kernel.pbMessage(_INTL("La {1} ha sido plantada en el suelo blando y fértil.",
PBItems.getName(berry)))
interp.setVariable(berryData)
end
return
end
end
else
if Kernel.pbConfirmMessage(_INTL("Es un suelo blando y fértil.\n¿Quieres plantar una Baya?"))
pbFadeOutIn(99999){
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
berry=screen.pbChooseBerryScreen
}
if berry>0
timenow=pbGetTimeNow
berryData[0]=1 berryData[1]=berry berryData[2]=false berryData[3]=timenow.to_i berryData[4]=0 berryData[5]=0 berryData[6]=nil; berryData[7]=nil; berryData.compact! $PokemonBag.pbDeleteItem(berry,1)
Kernel.pbMessage(_INTL("{1} ha plantado una {2} en el suelo blando y arcilloso.",
$Trainer.name,PBItems.getName(berry)))
interp.setVariable(berryData)
end
return
end
end
when 1 Kernel.pbMessage(_INTL("Aquí hay plantada una {1}.",PBItems.getName(berry)))
when 2 Kernel.pbMessage(_INTL("La {1} ha brotado.",PBItems.getName(berry)))
when 3 Kernel.pbMessage(_INTL("Esta planta de {1} sigue creciendo.",PBItems.getName(berry)))
when 4 if NEWBERRYPLANTS
Kernel.pbMessage(_INTL("¡Esta planta de {1} está floreciendo!",PBItems.getName(berry)))
else
case berryData[4]
when 4
Kernel.pbMessage(_INTL("¡Esta planta de {1} tiene una floración fabulosa!",PBItems.getName(berry)))
when 3
Kernel.pbMessage(_INTL("¡Esta planta de {1} está floreciendo muy bellamente!",PBItems.getName(berry)))
when 2
Kernel.pbMessage(_INTL("¡Esta planta de {1} está floreciendo hermosamente!",PBItems.getName(berry)))
when 1
Kernel.pbMessage(_INTL("¡Esta planta de {1} está floreciendo tiernamente!",PBItems.getName(berry)))
else
Kernel.pbMessage(_INTL("¡Esta planta de {1} está en flor!",PBItems.getName(berry)))
end
end
when 5 berryvalues=$PokemonTemp.pbGetBerryPlantData(berryData[1])
berrycount=1
if berryData.length>6
berrycount=[berryvalues[3]-berryData[6],berryvalues[2]].max
else
if berryData[4]>0
randomno=rand(1+berryvalues[3]-berryvalues[2])
berrycount=(((berryvalues[3]-berryvalues[2])*(berryData[4]-1)+randomno)/4).floor+berryvalues[2]
else
berrycount=berryvalues[2]
end
end
itemname=(berrycount>1) ? PBItems.getNamePlural(berry) : PBItems.getName(berry)
if berrycount>1
message=_INTL("¡El arbusto de {2} ha dado {1} bayas!\n¿Quieres cosecharlas?",berrycount,itemname)
else
message=_INTL("¡El arbusto de {1} ha dado una baya!\n¿Quieres cosecharlas?",itemname)
end
if Kernel.pbConfirmMessage(message)
if !$PokemonBag.pbCanStore?(berry,berrycount)
Kernel.pbMessage(_INTL("Qué mal...\nLa mochila está llena."))
return
end
$PokemonBag.pbStoreItem(berry,berrycount)
if berrycount>1
Kernel.pbMessage(_INTL("Has cosechado {1} bayas del arbusto de {2}.\\wtnp[30]",berrycount,itemname))
else
Kernel.pbMessage(_INTL("Has cosechado una baya del arbusto de {1}.\\wtnp[30]",itemname))
end
Kernel.pbMessage(_INTL("{1} ha metido la cosecha de {2} en el Bolsillo de <icon=bagPocket#{BERRYPOCKET}>\\c[1]Bayas\\c[0] de la Mochila.\1",
$Trainer.name,itemname))
if NEWBERRYPLANTS
Kernel.pbMessage(_INTL("El suelo se ha vuelto blando y fértil de nuevo.\1"))
berryData=[0,0,0,0,0,0,0,0]
else
Kernel.pbMessage(_INTL("El suelo se ha vuelto blando y fértil de nuevo.\1"))
berryData=[0,0,false,0,0,0]
end
interp.setVariable(berryData)
end
end
case berryData[0]
when 1, 2, 3, 4
for i in watering
if i!=0 && $PokemonBag.pbQuantity(i)>0
if Kernel.pbConfirmMessage(_INTL("¿Quieres regar la tierra con la {1}?",PBItems.getName(i)))
if berryData.length>6
berryData[4]=100
else
if berryData[2]==false
berryData[4]+=1
berryData[2]=true
end
end
interp.setVariable(berryData)
Kernel.pbMessage(_INTL("{1} ha regado bien la tierra y ahora es más fértil.\\wtnp[40]",$Trainer.name))
if NEWBERRYPLANTS
Kernel.pbMessage(_INTL("¡Listo! ¡Todos contentos!"))
else
Kernel.pbMessage(_INTL("Parece sentarle muy bien a la planta."))
end
end
break
end
end
end
end
|
#pbBGMFade(x = 0.0) ⇒ Object
Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
73
|
# File 'scripts/AudioPlay.rb', line 73
def pbBGMFade(x=0.0); pbBGMStop(x);end
|
#pbBGMPlay(param, volume = nil, pitch = nil) ⇒ Object
Plays a BGM file. param – Either a string showing the filename (relative to Audio/BGM/) or an RPG::AudioFile object. Possible formats for param: filename volume and pitch 100 filename:volume pitch 100 filename:volume:pitch volume – Volume of the file, up to 100 pitch – Pitch of the file, normally 100
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'scripts/AudioPlay.rb', line 55
def pbBGMPlay(param,volume=nil,pitch=nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
if $game_system && $game_system.respond_to?("bgm_play")
$game_system.bgm_play(param)
return
elsif (RPG.const_defined?(:BGM) rescue false)
b=RPG::BGM.new(param.name,param.volume,param.pitch)
if b && b.respond_to?("play")
b.play; return
end
end
Audio.bgm_play(canonicalize("Audio/BGM/"+param.name),param.volume,param.pitch)
end
end
|
#pbBGMStop(timeInSeconds = 0.0) ⇒ Object
Fades out or stops BGM playback. 'x' is the time in seconds to fade out.
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'scripts/AudioPlay.rb', line 76
def pbBGMStop(timeInSeconds=0.0)
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("bgm_fade")
$game_system.bgm_fade(timeInSeconds)
return
elsif $game_system && $game_system.respond_to?("bgm_stop")
$game_system.bgm_stop
return
elsif (RPG.const_defined?(:BGM) rescue false)
begin
(timeInSeconds>0.0) ? RPG::BGM.fade((timeInSeconds*1000).floor) : RPG::BGM.stop
return
rescue
end
end
(timeInSeconds>0.0) ? Audio.bgm_fade((timeInSeconds*1000).floor) : Audio.bgm_stop
end
|
#pbBGSFade(x = 0.0) ⇒ Object
Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
171
|
# File 'scripts/AudioPlay.rb', line 171
def pbBGSFade(x=0.0); pbBGSStop(x);end
|
#pbBGSPlay(param, volume = nil, pitch = nil) ⇒ Object
Plays a BGS file. param – Either a string showing the filename (relative to Audio/BGS/) or an RPG::AudioFile object. Possible formats for param: filename volume and pitch 100 filename:volume pitch 100 filename:volume:pitch volume – Volume of the file, up to 100 pitch – Pitch of the file, normally 100
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'scripts/AudioPlay.rb', line 153
def pbBGSPlay(param,volume=nil,pitch=nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
if $game_system && $game_system.respond_to?("bgs_play")
$game_system.bgs_play(param)
return
elsif (RPG.const_defined?(:BGS) rescue false)
b=RPG::BGS.new(param.name,param.volume,param.pitch)
if b && b.respond_to?("play")
b.play; return
end
end
Audio.bgs_play(canonicalize("Audio/BGS/"+param.name),param.volume,param.pitch)
end
end
|
#pbBGSStop(timeInSeconds = 0.0) ⇒ Object
Fades out or stops BGS playback. 'x' is the time in seconds to fade out.
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# File 'scripts/AudioPlay.rb', line 174
def pbBGSStop(timeInSeconds=0.0)
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("bgs_fade")
$game_system.bgs_fade(timeInSeconds)
return
elsif $game_system && $game_system.respond_to?("bgs_play")
$game_system.bgs_play(nil)
return
elsif (RPG.const_defined?(:BGS) rescue false)
begin
(timeInSeconds>0.0) ? RPG::BGS.fade((timeInSeconds*1000).floor) : RPG::BGS.stop
return
rescue
end
end
(timeInSeconds>0.0) ? Audio.bgs_fade((timeInSeconds*1000).floor) : Audio.bgs_stop
end
|
#pbBitmapName(x) ⇒ Object
Finds the real path for an image file. This includes paths in encrypted archives. Returns x if the path can't be found.
1390
1391
1392
1393
|
# File 'scripts/SpriteWindow.rb', line 1390
def pbBitmapName(x)
ret=pbResolveBitmap(x)
return ret ? ret : x
end
|
#pbBottomLeft(window) ⇒ Object
1002
1003
1004
1005
|
# File 'scripts/SpriteWindow.rb', line 1002
def pbBottomLeft(window)
window.x=0
window.y=Graphics.height-window.height
end
|
#pbBottomLeftLines(window, lines, width = nil) ⇒ Object
1007
1008
1009
1010
1011
1012
|
# File 'scripts/SpriteWindow.rb', line 1007
def pbBottomLeftLines(window,lines,width=nil)
window.x=0
window.width=width ? width : Graphics.width
window.height=(window.borderY rescue 32)+lines*32
window.y=Graphics.height-window.height
end
|
#pbBottomRight(window) ⇒ Object
997
998
999
1000
|
# File 'scripts/SpriteWindow.rb', line 997
def pbBottomRight(window)
window.x=Graphics.width-window.width
window.y=Graphics.height-window.height
end
|
#pbBridgeOff ⇒ Object
2176
2177
2178
|
# File 'scripts/PField_Field.rb', line 2176
def pbBridgeOff
$PokemonGlobal.bridge=0
end
|
#pbBridgeOn(height = 2) ⇒ Object
2172
2173
2174
|
# File 'scripts/PField_Field.rb', line 2172
def pbBridgeOn(height=2)
$PokemonGlobal.bridge=height
end
|
#pbBugContestBattle(species, level) ⇒ Object
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
# File 'scripts/PBattle_BugContest.rb', line 414
def pbBugContestBattle(species,level)
genwildpoke=pbGenerateWildPokemon(species,level)
Events.onStartBattle.trigger(nil,genwildpoke)
scene=pbNewBattleScene
battle=PokeBattle_BugContestBattle.new(scene,$Trainer.party,[genwildpoke],$Trainer,nil)
battle.ballcount=pbBugContestState.ballcount
battle.internalbattle=true
decision=0
pbBattleAnimation(pbGetWildBattleBGM(species)) {
decision=battle.pbStartBattle
Events.onEndBattle.trigger(nil,decision,true)
if decision==2 || decision==5
$game_system.bgm_unpause
$game_system.bgs_unpause
Kernel.pbBugContestStartOver
end
}
pbBugContestState.ballcount=battle.ballcount
Input.update
Events.onWildBattleEnd.trigger(nil,species,level,decision)
if pbBugContestState.ballcount==0
Kernel.pbMessage("ANUNCIADOR: ¡El Concurso Cazabichos ha terminado!")
pbBugContestState.pbStartJudging
end
return (decision!=2 && decision!=5)
end
|
#pbBugContestDecided? ⇒ Boolean
Returns true if the Bug Catching Contest in progress and is being judged
268
269
270
|
# File 'scripts/PBattle_BugContest.rb', line 268
def pbBugContestDecided?
return pbBugContestState.decided?
end
|
#pbBugContestScore(pokemon) ⇒ Object
Returns a score for this Pokemon in the Bug Catching Contest. Not exactly the HGSS calculation, but it should be decent enough.
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
# File 'scripts/PBattle_BugContest.rb', line 233
def pbBugContestScore(pokemon)
levelscore=pokemon.level*4
ivscore=0
for i in pokemon.iv; ivscore+=i; end
ivscore=(ivscore*100/186).floor
hpscore=(100*pokemon.hp/pokemon.totalhp).floor
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,pokemon.species,16)
rareness=dexdata.fgetb
dexdata.close
rarescore=60
rarescore+=20 if rareness<=120
rarescore+=20 if rareness<=60
score=levelscore+ivscore+hpscore+rarescore
return score
end
|
#pbBugContestState ⇒ Object
250
251
252
253
254
255
|
# File 'scripts/PBattle_BugContest.rb', line 250
def pbBugContestState
if !$PokemonGlobal.bugContestState
$PokemonGlobal.bugContestState=BugContestState.new
end
return $PokemonGlobal.bugContestState
end
|
#pbBugContestUndecided? ⇒ Boolean
Returns true if the Bug Catching Contest in progress and has not yet been judged
263
264
265
|
# File 'scripts/PBattle_BugContest.rb', line 263
def pbBugContestUndecided?
return pbBugContestState.undecided?
end
|
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
# File 'scripts/Messages.rb', line 393
def pbButtonInputProcessing(variableNumber=0,timeoutFrames=0)
ret=0
loop do
Graphics.update
Input.update
pbUpdateSceneMap
for i in 1..18
if Input.trigger?(i)
ret=i
end
end
break if ret!=0
if timeoutFrames && timeoutFrames>0
i+=1
break if i>=timeoutFrames
end
end
Input.update
if variableNumber && variableNumber>0
$game_variables[variableNumber]=ret
$game_map.need_refresh = true if $game_map
end
return ret
end
|
#pbBuyTriads ⇒ Object
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
|
# File 'scripts/PMinigame_TripleTriad.rb', line 1067
def pbBuyTriads
commands=[]
realcommands=[]
for i in 1..PBSpecies.maxValue
if $Trainer.owned[i]
speciesname=PBSpecies.getName(i)
next if !speciesname
price=TriadCard.new(i).price
commands.push([price,speciesname,_INTL("{1} ${2}",speciesname,price),i])
end
end
if commands.length==0
Kernel.pbMessage(_INTL("There are no cards that you can buy."))
return
end
commands.sort!{|a,b|
if a[0]==b[0]
a[1]<=>b[1] else
a[0]<=>b[0] end
}
for command in commands
realcommands.push(command[2])
end
pbScrollMap(4,3,5)
cmdwindow=Window_CommandPokemonEx.newWithSize(realcommands,0,0,256,Graphics.height)
cmdwindow.z=99999
moneyString=_INTL("${1}",$Trainer.money)
goldwindow=Window_UnformattedTextPokemon.newWithSize(
_INTL("Money:\n{1}",moneyString),0,0,32,32)
goldwindow.resizeToFit(goldwindow.text,Graphics.width)
goldwindow.y=0
goldwindow.x=Graphics.width-goldwindow.width
goldwindow.z=99999
Graphics.frame_reset
done=false
while !done
loop do
Graphics.update
Input.update
cmdwindow.active=true
cmdwindow.update
goldwindow.update
if Input.trigger?(Input::B)
done=true
break
end
if Input.trigger?(Input::C)
price=commands[cmdwindow.index][0]
item=commands[cmdwindow.index][3]
itemname=commands[cmdwindow.index][1]
cmdwindow.active=false
cmdwindow.update
if $Trainer.money<price
Kernel.pbMessage(_INTL("You don't have enough money."))
break
end
maxafford=(price<=0) ? 99 : $Trainer.money/price
maxafford=99 if maxafford>99
params=ChooseNumberParams.new
params.setRange(1,maxafford)
params.setInitialValue(1)
params.setCancelValue(0)
quantity=Kernel.pbMessageChooseNumber(
_INTL("The {1} card? Certainly.\r\nHow many would you like?",itemname),params)
if quantity>0
price*=quantity
if !Kernel.pbConfirmMessage(_INTL("{1}, and you want {2}.\r\nThat will be ${3}. OK?",itemname,quantity,price))
break
end
if $Trainer.money<price
Kernel.pbMessage(_INTL("You don't have enough money."))
break
end
if !$PokemonGlobal.triads.pbCanStore?(item,quantity)
Kernel.pbMessage(_INTL("You have no room for more cards."))
else
$PokemonGlobal.triads.pbStoreItem(item,quantity)
$Trainer.money-=price
moneyString=_INTL("${1}",$Trainer.money)
goldwindow.text=_INTL("Money:\n{1}",moneyString)
Kernel.pbMessage(_INTL("Here you are!\r\nThank you!"))
end
end
end
end
end
cmdwindow.dispose
goldwindow.dispose
Graphics.frame_reset
pbScrollMap(6,3,5)
end
|
#pbCallTitle ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'scripts/Main.rb', line 19
def pbCallTitle if $DEBUG
return Scene_DebugIntro.new
else
return Scene_Intro.new(['intro1'], 'splash')
end
end
|
#pbCallTrainer(trtype, trname) ⇒ Object
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# File 'scripts/PScreen_Phone.rb', line 143
def pbCallTrainer(trtype,trname)
trainer=pbFindPhoneTrainer(trtype,trname)
if trainer
if trainer.length==8
if $game_player && $game_map.map_id==trainer[6]
Kernel.pbMessage(_INTL("El entrenador está cerca.\n¡Háblale en persona!"))
return
end
callerregion=pbGetMetadata(trainer[6],MetadataMapPosition)
currentregion=pbGetMetadata($game_map.map_id,MetadataMapPosition)
if callerregion && currentregion && callerregion[0]!=currentregion[0]
Kernel.pbMessage(_INTL("El entrenador está fuera de rango."))
return end
call=pbPhoneGenerateCall(trainer)
pbPhoneCall(call,trainer)
else
if !pbCommonEvent(trtype)
Kernel.pbMessage(_INTL("No se definieron mensajes de {1}.\nNo se puedo llamar al evento común {2}.",trainer[2],trtype))
end
end
end
end
|
#pbCanUseBike?(mapid) ⇒ Boolean
#pbCanUsePokeRadar? ⇒ Boolean
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'scripts/PItem_PokeRadar.rb', line 16
def pbCanUsePokeRadar?
if !PBTerrain.isJustGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
Kernel.pbMessage(_INTL("No se puede usar aquí."))
return false
end
if !$PokemonEncounters.isRegularGrass?
Kernel.pbMessage(_INTL("No se puede usar aquí."))
return false
end
if $PokemonGlobal.bicycle
Kernel.pbMessage(_INTL("No se puede usar en la bicicleta."))
return false
end
return true if $DEBUG && Input.press?(Input::CTRL)
if $PokemonGlobal.pokeradarBattery && $PokemonGlobal.pokeradarBattery>0
Kernel.pbMessage(_INTL("¡Se ha agotado la batería!\nPara recargarlo, necesitas caminar otros {1} pasos.",
$PokemonGlobal.pokeradarBattery))
return false
end
return true
end
|
#pbCaveEntranceEx(exiting) ⇒ Object
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
|
# File 'scripts/PField_Field.rb', line 1777
def pbCaveEntranceEx(exiting)
sprite=BitmapSprite.new(Graphics.width,Graphics.height)
sprite.z=100000
totalBands=15
totalFrames=15
bandheight=((Graphics.height/2)-10).to_f/totalBands
bandwidth=((Graphics.width/2)-12).to_f/totalBands
grays=[]
tbm1=totalBands-1
for i in 0...totalBands
grays.push(exiting ? 0 : 255)
end
totalFrames.times do |j|
x=0
y=0
rectwidth=Graphics.width
rectheight=Graphics.height
for k in 0...j
t=(255.0)/totalFrames
if exiting
t=1.0-t
t*=1.0+((k)/totalFrames.to_f)
else
t*=1.0+0.3*(((totalFrames-k)/totalFrames.to_f)**0.7)
end
grays[k]-=t
grays[k]=0 if grays[k]<0
end
for i in 0...totalBands
currentGray=grays[i]
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
Color.new(currentGray,currentGray,currentGray))
x+=bandwidth
y+=bandheight
rectwidth-=bandwidth*2
rectheight-=bandheight*2
end
Graphics.update
Input.update
end
if exiting
pbToneChangeAll(Tone.new(255,255,255),0)
else
pbToneChangeAll(Tone.new(-255,-255,-255),0)
end
for j in 0..15
if exiting
sprite.color=Color.new(255,255,255,j*255/15)
else
sprite.color=Color.new(0,0,0,j*255/15)
end
Graphics.update
Input.update
end
pbToneChangeAll(Tone.new(0,0,0),8)
for j in 0..5
Graphics.update
Input.update
end
sprite.dispose
end
|
#pbCellBatch(canvas) ⇒ Object
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
|
# File 'scripts/BattleAnimationEditor.rb', line 2601
def pbCellBatch(canvas)
sliderwin1=ControlWindow.new(0,0,300,32*5)
sliderwin1.viewport=canvas.viewport
sliderwin1.opacity=200
s1set0=sliderwin1.addSlider(_INTL("First Frame:"),1,canvas.animation.length,1)
s1set1=sliderwin1.addSlider(_INTL("Last Frame:"),1,canvas.animation.length,canvas.animation.length)
s1set2=sliderwin1.addSlider(_INTL("First Cel:"),0,PBAnimation::MAXSPRITES-1,0)
s1set3=sliderwin1.addSlider(_INTL("Last Cel:"),0,PBAnimation::MAXSPRITES-1,PBAnimation::MAXSPRITES-1)
sliderwin2=ControlWindow.new(300,0,340,32*14)
sliderwin2.viewport=canvas.viewport
sliderwin2.opacity=200
set0=sliderwin2.addOptionalSlider(_INTL("Pattern:"),-2,1000,0)
set1=sliderwin2.addOptionalSlider(_INTL("X:"),-64,512+64,0)
set2=sliderwin2.addOptionalSlider(_INTL("Y:"),-64,384+64,0)
set3=sliderwin2.addOptionalSlider(_INTL("Zoom X:"),5,1000,100)
set4=sliderwin2.addOptionalSlider(_INTL("Zoom Y:"),5,1000,100)
set5=sliderwin2.addOptionalSlider(_INTL("Angle:"),0,359,0)
set6=sliderwin2.addOptionalSlider(_INTL("Opacity:"),0,255,255)
set7=sliderwin2.addOptionalSlider(_INTL("Blending:"),0,2,0)
set8=sliderwin2.addOptionalTextSlider(_INTL("Flip:"),[_INTL("False"),_INTL("True")],0)
prio=[_INTL("Back"),_INTL("Front"),_INTL("Behind focus"),_INTL("Above focus")]
set9=sliderwin2.addOptionalTextSlider(_INTL("Priority:"),prio,1)
foc=[_INTL("User"),_INTL("Target"),_INTL("User and target"),_INTL("Screen")]
curfoc=[3,1,0,2,3][canvas.animation.position || 4]
set10=sliderwin2.addOptionalTextSlider(_INTL("Focus:"),foc,curfoc)
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
loop do
Graphics.update
Input.update
sliderwin1.update
sliderwin2.update
if sliderwin2.changed?(okbutton) || Input.trigger?(Input::C)
startframe=sliderwin1.value(s1set0)-1
endframe=sliderwin1.value(s1set1)-1
startcel=sliderwin1.value(s1set2)
endcel=sliderwin1.value(s1set3)
for i in startframe..endframe
for j in startcel..endcel
next if !canvas.animation[i][j]
cel=canvas.animation[i][j]
cel[AnimFrame::PATTERN]=sliderwin2.value(set0) if sliderwin2.value(set0)
cel[AnimFrame::X]=sliderwin2.value(set1) if sliderwin2.value(set1)
cel[AnimFrame::Y]=sliderwin2.value(set2) if sliderwin2.value(set2)
cel[AnimFrame::ZOOMX]=sliderwin2.value(set3) if sliderwin2.value(set3)
cel[AnimFrame::ZOOMY]=sliderwin2.value(set4) if sliderwin2.value(set4)
cel[AnimFrame::ANGLE]=sliderwin2.value(set5) if sliderwin2.value(set5)
cel[AnimFrame::OPACITY]=sliderwin2.value(set6) if sliderwin2.value(set6)
cel[AnimFrame::BLENDTYPE]=sliderwin2.value(set7) if sliderwin2.value(set7)
cel[AnimFrame::MIRROR]=sliderwin2.value(set8) if sliderwin2.value(set8)
cel[AnimFrame::PRIORITY]=sliderwin2.value(set9) if sliderwin2.value(set9)
cel[AnimFrame::FOCUS]=[2,1,3,4][sliderwin2.value(set10)] if sliderwin2.value(set10)
end
end
canvas.invalidate
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin1.dispose
sliderwin2.dispose
end
|
#pbCellProperties(canvas) ⇒ Object
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
|
# File 'scripts/BattleAnimationEditor.rb', line 2034
def pbCellProperties(canvas)
cel=canvas.currentCel.clone return if !cel
sliderwin2=ControlWindow.new(0,0,320,32*16)
previewwin=ControlWindow.new(320,0,192,192)
sliderwin2.viewport=canvas.viewport
previewwin.viewport=canvas.viewport
previewsprite=Sprite.new(canvas.viewport)
previewsprite.bitmap=canvas.animbitmap
previewsprite.z=previewwin.z+1
sliderwin2.z=previewwin.z+2
set0=sliderwin2.addSlider(_INTL("Pattern:"),-2,1000,cel[AnimFrame::PATTERN])
set1=sliderwin2.addSlider(_INTL("X:"),-64,512+64,cel[AnimFrame::X])
set2=sliderwin2.addSlider(_INTL("Y:"),-64,384+64,cel[AnimFrame::Y])
set3=sliderwin2.addSlider(_INTL("Zoom X:"),5,1000,cel[AnimFrame::ZOOMX])
set4=sliderwin2.addSlider(_INTL("Zoom Y:"),5,1000,cel[AnimFrame::ZOOMY])
set5=sliderwin2.addSlider(_INTL("Angle:"),0,359,cel[AnimFrame::ANGLE])
set6=sliderwin2.addSlider(_INTL("Opacity:"),0,255,cel[AnimFrame::OPACITY])
set7=sliderwin2.addSlider(_INTL("Blending:"),0,2,cel[AnimFrame::BLENDTYPE])
set8=sliderwin2.addTextSlider(_INTL("Flip:"),[_INTL("False"),_INTL("True")],cel[AnimFrame::MIRROR])
prio=[_INTL("Back"),_INTL("Front"),_INTL("Behind focus"),_INTL("Above focus")]
set9=sliderwin2.addTextSlider(_INTL("Priority:"),prio,cel[AnimFrame::PRIORITY] || 1)
foc=[_INTL("User"),_INTL("Target"),_INTL("User and target"),_INTL("Screen")]
curfoc=[3,1,0,2,3][cel[AnimFrame::FOCUS] || canvas.animation.position || 4]
set10=sliderwin2.addTextSlider(_INTL("Focus:"),foc,curfoc)
flashbutton=sliderwin2.addButton(_INTL("Set Blending Color"))
tonebutton=sliderwin2.addButton(_INTL("Set Color Tone"))
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
cel[AnimFrame::X]=320+96
cel[AnimFrame::Y]=96
canvas.setSpriteBitmap(previewsprite,cel)
pbSpriteSetAnimFrame(previewsprite,cel,nil,nil)
previewsprite.z=previewwin.z+1
sliderwin2.opacity=200
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(set0) ||
sliderwin2.changed?(set3) ||
sliderwin2.changed?(set4) ||
sliderwin2.changed?(set5) ||
sliderwin2.changed?(set6) ||
sliderwin2.changed?(set7) ||
sliderwin2.changed?(set8) ||
sliderwin2.changed?(set9) ||
sliderwin2.changed?(set10)
cel[AnimFrame::PATTERN]=sliderwin2.value(set0) if set0>=0
cel[AnimFrame::ZOOMX]=sliderwin2.value(set3)
cel[AnimFrame::ZOOMY]=sliderwin2.value(set4)
cel[AnimFrame::ANGLE]=sliderwin2.value(set5)
cel[AnimFrame::OPACITY]=sliderwin2.value(set6)
cel[AnimFrame::BLENDTYPE]=sliderwin2.value(set7)
cel[AnimFrame::MIRROR]=sliderwin2.value(set8)
cel[AnimFrame::PRIORITY]=sliderwin2.value(set9)
cel[AnimFrame::FOCUS]=[2,1,3,4][sliderwin2.value(set10)]
canvas.setSpriteBitmap(previewsprite,cel)
pbSpriteSetAnimFrame(previewsprite,cel,nil,nil)
previewsprite.z=previewwin.z+1
end
if sliderwin2.changed?(flashbutton)
pbSetFlash(cel,previewsprite)
pbSpriteSetAnimFrame(previewsprite,cel,nil,nil)
previewsprite.z=previewwin.z+1
end
if sliderwin2.changed?(tonebutton)
pbSetTone(cel,previewsprite)
pbSpriteSetAnimFrame(previewsprite,cel,nil,nil)
previewsprite.z=previewwin.z+1
end
if sliderwin2.changed?(okbutton)
cel[AnimFrame::PATTERN]=sliderwin2.value(set0) if set0>=0
cel[AnimFrame::X]=sliderwin2.value(set1)
cel[AnimFrame::Y]=sliderwin2.value(set2)
cel[AnimFrame::ZOOMX]=sliderwin2.value(set3)
cel[AnimFrame::ZOOMY]=sliderwin2.value(set4)
cel[AnimFrame::ANGLE]=sliderwin2.value(set5)
cel[AnimFrame::OPACITY]=sliderwin2.value(set6)
cel[AnimFrame::BLENDTYPE]=sliderwin2.value(set7)
cel[AnimFrame::MIRROR]=sliderwin2.value(set8)
cel[AnimFrame::PRIORITY]=sliderwin2.value(set9)
cel[AnimFrame::FOCUS]=[2,1,3,4][sliderwin2.value(set10)]
thiscel=canvas.currentCel
thiscel[0,thiscel.length]=cel
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
previewwin.dispose
previewsprite.dispose
sliderwin2.dispose
return
end
|
#pbChangeLevel(pokemon, newlevel, scene) ⇒ Object
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
# File 'scripts/PItem_Items.rb', line 263
def pbChangeLevel(pokemon,newlevel,scene)
newlevel=1 if newlevel<1
newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
if pokemon.level>newlevel
attackdiff=pokemon.attack
defensediff=pokemon.defense
speeddiff=pokemon.speed
spatkdiff=pokemon.spatk
spdefdiff=pokemon.spdef
totalhpdiff=pokemon.totalhp
pokemon.level=newlevel
pokemon.calcStats
scene.pbRefresh
Kernel.pbMessage(_INTL("¡{1} ha sido bajado al nivel {2}!",pokemon.name,pokemon.level))
attackdiff=pokemon.attack-attackdiff
defensediff=pokemon.defense-defensediff
speeddiff=pokemon.speed-speeddiff
spatkdiff=pokemon.spatk-spatkdiff
spdefdiff=pokemon.spdef-spdefdiff
totalhpdiff=pokemon.totalhp-totalhpdiff
pbTopRightWindow(_INTL("PS Máx.<r>{1}\r\nAtaque<r>{2}\r\nDefensa<r>{3}\r\nAt. Esp.<r>{4}\r\nDef. Esp.<r>{5}\r\nVelocidad<r>{6}",
totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
pbTopRightWindow(_INTL("PS Máx.<r>{1}\r\nAtaque<r>{2}\r\nDefensa<r>{3}\r\nAt. Esp.<r>{4}\r\nDef. Esp.<r>{5}\r\nVelocidad<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
elsif pokemon.level==newlevel
Kernel.pbMessage(_INTL("El nivel de {1} no ha cambiado.",pokemon.name))
else
attackdiff=pokemon.attack
defensediff=pokemon.defense
speeddiff=pokemon.speed
spatkdiff=pokemon.spatk
spdefdiff=pokemon.spdef
totalhpdiff=pokemon.totalhp
oldlevel=pokemon.level
pokemon.level=newlevel
pokemon.changeHappiness("level up")
pokemon.calcStats
scene.pbRefresh
Kernel.pbMessage(_INTL("¡{1} ha subido al nivel {2}!",pokemon.name,pokemon.level))
attackdiff=pokemon.attack-attackdiff
defensediff=pokemon.defense-defensediff
speeddiff=pokemon.speed-speeddiff
spatkdiff=pokemon.spatk-spatkdiff
spdefdiff=pokemon.spdef-spdefdiff
totalhpdiff=pokemon.totalhp-totalhpdiff
pbTopRightWindow(_INTL("PS Máx.<r>+{1}\r\nAtaque<r>+{2}\r\nDefensa<r>+{3}\r\nAt. Esp.<r>+{4}\r\nDef. Esp.<r>+{5}\r\nVelocidad<r>+{6}",
totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
pbTopRightWindow(_INTL("PS Máx.<r>{1}\r\nAtaque<r>{2}\r\nDefensa<r>{3}\r\nAt. Esp.<r>{4}\r\nDef. Esp.<r>{5}\r\nVelocidad<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
movelist=pokemon.getMoveList
for i in movelist
if i[0]==pokemon.level pbLearnMove(pokemon,i[1],true)
end
end
newspecies=pbCheckEvolution(pokemon)
if newspecies>0
pbFadeOutInWithMusic(99999){
evo=PokemonEvolutionScene.new
evo.pbStartScreen(pokemon,newspecies)
evo.pbEvolution
evo.pbEndScreen
}
end
end
end
|
#pbChangeMaximum(canvas) ⇒ Object
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
|
# File 'scripts/BattleAnimationEditor.rb', line 2770
def pbChangeMaximum(canvas)
sliderwin2=ControlWindow.new(0,0,320,32*4)
sliderwin2.viewport=canvas.viewport
sliderwin2.addSlider(_INTL("Frames:"),1,1000,canvas.animation.length)
okbutton=sliderwin2.addButton(_INTL("OK"))
cancelbutton=sliderwin2.addButton(_INTL("Cancel"))
sliderwin2.opacity=200
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
canvas.animation.resize(sliderwin2.value(0))
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
return
end
|
#pbChangeScript(script, re) ⇒ Object
3353
3354
3355
3356
3357
3358
3359
|
# File 'scripts/Compiler.rb', line 3353
def pbChangeScript(script,re)
tmp=script[0].gsub(re){ yield($~) }
if script[0]!=tmp
script[0]=tmp; return true
end
return false
end
|
#pbChangeScripts(script) ⇒ Object
3361
3362
3363
3364
3365
3366
|
# File 'scripts/Compiler.rb', line 3361
def pbChangeScripts(script)
changed=false
changed|=pbChangeScript(script,/\$game_variables\[(\d+)\](?!\s*(?:\=|\!|<|>))/){|m| "pbGet("+m[1]+")" }
changed|=pbChangeScript(script,/\$Trainer\.party\[\s*pbGet\((\d+)\)\s*\]/){|m| "pbGetPokemon("+m[1]+")" }
return changed
end
|
#pbChatter(pokemon) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'scripts/Pokemon_Chatter.rb', line 7
def pbChatter(pokemon)
iconwindow=PictureWindow.new(pbLoadPokemonBitmap(pokemon))
iconwindow.x=(Graphics.width/2)-(iconwindow.width/2)
iconwindow.y=((Graphics.height-96)/2)-(iconwindow.height/2)
if pokemon.chatter
Kernel.pbMessage(_INTL("Está por olvidar la canción que conoce."))
if !Kernel.pbConfirmMessage(_INTL("¿Quieres cambiarla?"))
iconwindow.dispose
return
end
end
if Kernel.pbConfirmMessage(_INTL("¿Quieres cambiar esta canción ahora?"))
wave=pbRecord(nil,5)
if wave
pokemon.chatter=wave
Kernel.pbMessage(_INTL("¡{1} ha aprendido una canción nueva!",pokemon.name))
end
end
iconwindow.dispose
return
end
|
#pbCheckAllFainted ⇒ Object
#pbCheckByte(x, valuename) ⇒ Object
Revisión de valores válidos
319
320
321
322
323
324
|
# File 'scripts/Compiler.rb', line 319
def pbCheckByte(x,valuename)
if x<0 || x>255
raise _INTL("El valor \"{1}\" debe estar entre 0 y 255 (0x00-0xFF en hex), se obtuvo un valor de {2}\r\n{3}",
valuename,x,FileLineData.linereport)
end
end
|
#pbCheckCounters(map, mapID, mapdata) ⇒ Object
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
|
# File 'scripts/Compiler.rb', line 3218
def pbCheckCounters(map,mapID,mapdata)
todelete=[]
changed=false
for key in map.events.keys
event=map.events[key]
next if !event
firstCommand=event.pages[0].list[0]
if isPlainEventOrMart?(event)
neighbors=[]
neighbors.push(mapdata.getEventFromXY(mapID,event.x,event.y-1))
neighbors.push(mapdata.getEventFromXY(mapID,event.x,event.y+1))
neighbors.push(mapdata.getEventFromXY(mapID,event.x-1,event.y))
neighbors.push(mapdata.getEventFromXY(mapID,event.x+1,event.y))
neighbors.compact!
for otherEvent in neighbors
next if isPlainEvent?(otherEvent)
if isLikelyCounter?(event,otherEvent,mapID,mapdata)
mapdata.setCounterTile(mapID,otherEvent.x,otherEvent.y)
savedPage=event.pages[0]
event.pages=otherEvent.pages
applyPages(savedPage,event.pages)
todelete.push(otherEvent.id)
changed=true
end
end
end
end
for key in todelete
map.events.delete(key)
end
return changed
end
|
#pbCheckEvolution(pokemon, item = 0) ⇒ Object
Revisa si un Pokémon puede evolucionar ahora. Si usa un objeto en el Pokémon, se revisa si el Pokémon puede evolucionar con ese objeto o no.
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
|
# File 'scripts/Pokemon_Evolution.rb', line 1248
def pbCheckEvolution(pokemon,item=0)
if item==0
return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
next pbMiniCheckEvolution(pokemon,evonib,level,poke)
}
else
return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
next pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)
}
end
end
|
#pbCheckEvolutionEx(pokemon) ⇒ Object
Revisa si un Pokémon puede evolucionar ahora. Si se da un bloque, se lo llama con los siguientes parámetros: Pokemon a revisar; tipo de evolución; nivel u otro parámetro; ID de la especie Pokémon nueva
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
|
# File 'scripts/Pokemon_Evolution.rb', line 1233
def pbCheckEvolutionEx(pokemon)
return -1 if pokemon.species<=0 || pokemon.isEgg?
return -1 if isConst?(pokemon.species,PBSpecies,:PICHU) && pokemon.form==1
return -1 if isConst?(pokemon.item,PBItems,:EVERSTONE) &&
!isConst?(pokemon.species,PBSpecies,:KADABRA)
ret=-1
for form in pbGetEvolvedFormData(pokemon.species)
ret=yield pokemon,form[0],form[1],form[2]
break if ret>0
end
return ret
end
|
#pbCheckSignedByte(x, valuename) ⇒ Object
326
327
328
329
330
331
|
# File 'scripts/Compiler.rb', line 326
def pbCheckSignedByte(x,valuename)
if x<-128 || x>127
raise _INTL("El valor \"{1}\" debe estar entre -128 y 127, se obtuvo un valor de {2}\r\n{3}",
valuename,x,FileLineData.linereport)
end
end
|
#pbCheckSignedWord(x, valuename) ⇒ Object
340
341
342
343
344
345
|
# File 'scripts/Compiler.rb', line 340
def pbCheckSignedWord(x,valuename)
if x<-32768 || x>32767
raise _INTL("El valor \"{1}\" debe estar entre -32768 y 32767, se obtuvo un valor de {2}\r\n{3}",
valuename,x,FileLineData.linereport)
end
end
|
#pbCheckUseOnPokemon(item, pokemon, screen) ⇒ Object
570
571
572
|
# File 'scripts/PItem_Items.rb', line 570
def pbCheckUseOnPokemon(item,pokemon,screen)
return pokemon && !pokemon.isEgg?
end
|
#pbCheckWord(x, valuename) ⇒ Object
333
334
335
336
337
338
|
# File 'scripts/Compiler.rb', line 333
def pbCheckWord(x,valuename)
if x<0 || x>65535
raise _INTL("El valor \"{1}\" debe estar entre 0 y 65535 (0x0000-0xFFFF en hex), se obtuvo un valor de {2}\r\n{3}",
valuename,x,FileLineData.linereport)
end
end
|
#pbChooseAbilityList(defaultAbilityID = 0) ⇒ Object
Displays a sorted list of abilities, and returns the ID of the ability selected or 0 if the selection was canceled. defaultItemID, if specified, indicates the ID of the ability initially shown on the list.
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
|
# File 'scripts/Editor.rb', line 1114
def pbChooseAbilityList(defaultAbilityID=0)
cmdwin=pbListWindow([],200)
commands=[]
abilityDefault=0
for c in PBAbilities.constants
i=PBAbilities.const_get(c)
if i.is_a?(Integer)
commands.push([i,PBAbilities.getName(i)])
end
end
commands.sort! {|a,b| a[1]<=>b[1]}
if defaultAbilityID>0
commands.each_with_index {|item,index|
abilityDefault=index if item[0]==defaultAbilityID
}
end
realcommands=[]
for command in commands
realcommands.push(sprintf("#{command[1]}"))
end
ret=pbCommands2(cmdwin,realcommands,-1,abilityDefault,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : 0
end
|
#pbChooseBallList(defaultMoveID = -1)) ⇒ Object
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
|
# File 'scripts/Editor.rb', line 2880
def pbChooseBallList(defaultMoveID=-1)
cmdwin=pbListWindow([],200)
commands=[]
moveDefault=0
for key in $BallTypes.keys
item=getID(PBItems,$BallTypes[key])
commands.push([key,item,PBItems.getName(item)]) if item && item>0
end
commands.sort! {|a,b| a[2]<=>b[2]}
if defaultMoveID>=0
for i in 0...commands.length
moveDefault=i if defaultMoveID==commands[i][0]
end
end
realcommands=[]
for i in commands
realcommands.push(i[2])
end
ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : defaultMoveID
end
|
#pbChooseItemFromList(message, variable, *args) ⇒ Object
Muestra una lista de objetos de dónde elegir, se guarda el ID del objeto elegido en la Variable Global determinada. Solamente se listan objetos que el jugador tiene.
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
|
# File 'scripts/PItem_Items.rb', line 734
def pbChooseItemFromList(message,variable,*args)
commands=[]
itemid=[]
for item in args
if hasConst?(PBItems,item)
id=getConst(PBItems,item)
if $PokemonBag.pbQuantity(id)>0
commands.push(PBItems.getName(id))
itemid.push(id)
end
end
end
if commands.length==0
$game_variables[variable]=0
return 0
end
commands.push(_INTL("Salir"))
itemid.push(0)
ret=Kernel.pbMessage(message,commands,-1)
if ret<0 || ret>=commands.length-1
$game_variables[variable]=-1
return -1
else
$game_variables[variable]=itemid[ret]
return itemid[ret]
end
end
|
#pbChooseItemList(defaultItemID = 0) ⇒ Object
Displays a sorted list of items, and returns the ID of the item selected or 0 if the selection was canceled. defaultItemID, if specified, indicates the ID of the item initially shown on the list.
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
|
# File 'scripts/Editor.rb', line 1086
def pbChooseItemList(defaultItemID=0)
cmdwin=pbListWindow([],200)
commands=[]
moveDefault=0
for c in PBItems.constants
i=PBItems.const_get(c)
if i.is_a?(Integer)
commands.push([i,PBItems.getName(i)])
end
end
commands.sort! {|a,b| a[1]<=>b[1]}
if defaultItemID>0
commands.each_with_index {|item,index|
moveDefault=index if item[0]==defaultItemID
}
end
realcommands=[]
for command in commands
realcommands.push(_ISPRINTF("{1:s}",command[1]))
end
ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : 0
end
|
#pbChooseLanguage ⇒ Object
19
20
21
22
23
24
25
|
# File 'scripts/PSystem_System.rb', line 19
def pbChooseLanguage
commands=[]
for lang in LANGUAGES
commands.push(lang[0])
end
return Kernel.pbShowCommands(nil,commands)
end
|
#pbChooseMoveList(defaultMoveID = 0) ⇒ Object
Displays a sorted list of moves, and returns the ID of the move selected or 0 if the selection was canceled. defaultMoveID, if specified, indicates the ID of the move initially shown on the list.
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
|
# File 'scripts/Editor.rb', line 1033
def pbChooseMoveList(defaultMoveID=0)
cmdwin=pbListWindow([],200)
commands=[]
moveDefault=0
for i in 1..PBMoves.maxValue
name=PBMoves.getName(i)
commands.push([i,name]) if name!=nil && name!=""
end
commands.sort! {|a,b| a[1]<=>b[1]}
if defaultMoveID>0
commands.each_with_index {|item,index|
moveDefault=index if item[0]==defaultMoveID
}
end
realcommands=[]
for command in commands
realcommands.push(_ISPRINTF("{1:s}",command[1]))
end
ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : 0
end
|
#pbChooseMoveListForSpecies(species, defaultMoveID = 0) ⇒ Object
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
|
# File 'scripts/Editor.rb', line 2968
def pbChooseMoveListForSpecies(species,defaultMoveID=0)
cmdwin=pbListWindow([],200)
commands=[]
moveDefault=0
legalMoves=pbGetLegalMoves(species)
for move in legalMoves
commands.push([move,PBMoves.getName(move)])
end
commands.sort! {|a,b| a[1]<=>b[1]}
if defaultMoveID>0
commands.each_with_index {|item,index|
if moveDefault==0
moveDefault=index if index[0]==defaultMoveID
end
}
end
commands2=[]
for i in 1..PBMoves.maxValue
if PBMoves.getName(i)!=nil && PBMoves.getName(i)!=""
commands2.push([i,PBMoves.getName(i)])
end
end
commands2.sort! {|a,b| a[1]<=>b[1]}
if defaultMoveID>0
commands2.each_with_index {|item,index|
if moveDefault==0
moveDefault=index if index[0]==defaultMoveID
end
}
end
commands.concat(commands2)
realcommands=[]
for command in commands
realcommands.push(_ISPRINTF("{2:s}",command[0],command[1]))
end
ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : 0
end
|
#pbChooseNum(cel) ⇒ Object
Pop-up menus for individual cels
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
|
# File 'scripts/BattleAnimationEditor.rb', line 1941
def pbChooseNum(cel)
ret=cel
sliderwin2=ControlWindow.new(0,0,320,32*5)
sliderwin2.z=99999
sliderwin2.addLabel(_INTL("Núm Anterior: {1}",cel))
sliderwin2.addSlider(_INTL("Núm Nuevo:"),2,PBAnimation::MAXSPRITES,cel)
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
ret=sliderwin2.value(1)
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
ret=-1
break
end
end
sliderwin2.dispose
return ret
end
|
#pbChooseNumber(msgwindow, params) ⇒ Object
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
|
# File 'scripts/Messages.rb', line 796
def pbChooseNumber(msgwindow,params)
return 0 if !params
ret=0
maximum=params.maxNumber
minimum=params.minNumber
defaultNumber=params.initialNumber
cancelNumber=params.cancelNumber
cmdwindow=Window_InputNumberPokemon.new(params.maxDigits)
cmdwindow.z=99999
cmdwindow.visible=true
cmdwindow.setSkin(params.skin) if params.skin
cmdwindow.sign=params.negativesAllowed cmdwindow.number=defaultNumber
curnumber=defaultNumber
pbPositionNearMsgWindow(cmdwindow,msgwindow,:right)
command=0
loop do
Graphics.update
Input.update
pbUpdateSceneMap
cmdwindow.update
msgwindow.update if msgwindow
yield if block_given?
if Input.trigger?(Input::C)
ret=cmdwindow.number
if ret>maximum
pbPlayBuzzerSE()
elsif ret<minimum
pbPlayBuzzerSE()
else
pbPlayDecisionSE()
break
end
elsif Input.trigger?(Input::B)
pbPlayCancelSE()
ret=cancelNumber
break
end
end
cmdwindow.dispose
Input.update
return ret
end
|
#pbChooseSpecies(default) ⇒ Object
973
974
975
976
977
978
979
980
981
982
983
|
# File 'scripts/Editor.rb', line 973
def pbChooseSpecies(default)
cmdwin=pbListWindow([],200)
commands=[]
for i in 1..PBSpecies.maxValue
cname=getConstantName(PBSpecies,i) rescue nil
commands.push(_ISPRINTF("{1:03d} {2:s}",i,PBSpecies.getName(i))) if cname
end
ret=pbCommands2(cmdwin,commands,-1,default-1,true)
cmdwin.dispose
return ret>=0 ? ret+1 : 0
end
|
#pbChooseSpeciesList(defaultItemID = 0) ⇒ Object
Displays a sorted list of Pokémon species, and returns the ID of the species selected or 0 if the selection was canceled. defaultItemID, if specified, indicates the ID of the species initially shown on the list.
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
|
# File 'scripts/Editor.rb', line 1005
def pbChooseSpeciesList(defaultItemID=0)
cmdwin=pbListWindow([],200)
commands=[]
itemDefault=0
for c in PBSpecies.constants
i=PBSpecies.const_get(c)
if i.is_a?(Integer)
commands.push([i,PBSpecies.getName(i)])
end
end
commands.sort! {|a,b| a[1]<=>b[1]}
if defaultItemID>0
commands.each_with_index {|item,index|
itemDefault=index if item[0]==defaultItemID
}
end
realcommands=[]
for command in commands
realcommands.push(_ISPRINTF("{1:s}",command[1]))
end
ret=pbCommands2(cmdwin,realcommands,-1,itemDefault,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : 0
end
|
#pbChooseSpeciesOrdered(default) ⇒ Object
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
|
# File 'scripts/Editor.rb', line 985
def pbChooseSpeciesOrdered(default)
cmdwin=pbListWindow([],200)
commands=[]
for i in 1..PBSpecies.maxValue
cname=getConstantName(PBSpecies,i) rescue nil
commands.push([i,PBSpecies.getName(i)]) if cname
end
commands.sort! {|a,b| a[1]<=>b[1]}
realcommands=[]
for command in commands
realcommands.push(_ISPRINTF("{1:03d} {2:s}",command[0],command[1]))
end
ret=pbCommands2(cmdwin,realcommands,-1,default-1,true)
cmdwin.dispose
return ret>=0 ? commands[ret][0] : 0
end
|
#pbChooseTypeList(defaultMoveID = 0, movetype = false) ⇒ Object
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
|
# File 'scripts/Editor.rb', line 1056
def pbChooseTypeList(defaultMoveID=0,movetype=false)
cmdwin=pbListWindow([],200)
commands=[]
moveDefault=0
for i in 0..PBTypes.maxValue
if !PBTypes.isPseudoType?(i)
commands.push([i,PBTypes.getName(i)])
end
end
commands.sort! {|a,b| a[1]<=>b[1]}
if defaultMoveID>0
commands.each_with_index {|item,index|
moveDefault=index if item[0]==defaultMoveID
}
end
realcommands=[]
for command in commands
realcommands.push(_ISPRINTF("{1:s}",command[1]))
end
loop do
ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true)
retval=ret>=0 ? commands[ret][0] : 0
cmdwin.dispose
return retval
end
end
|
#pbClearData ⇒ Object
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'scripts/MiscData.rb', line 168
def pbClearData
if $PokemonTemp
$PokemonTemp.pokemonDexData=nil
$PokemonTemp.pokemonMetadata=nil
$PokemonTemp.pokemonPhoneData=nil
end
MapFactoryHelper.clear
if $game_map && $PokemonEncounters
$PokemonEncounters.setup($game_map.map_id)
end
if pbRgssExists?("Data/Tilesets.rxdata")
$data_tilesets=load_data("Data/Tilesets.rxdata")
end
if pbRgssExists?("Data/Tilesets.rvdata")
$data_tilesets=load_data("Data/Tilesets.rvdata")
end
end
|
#pbClearFrames(canvas) ⇒ Object
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
|
# File 'scripts/BattleAnimationEditor.rb', line 2496
def pbClearFrames(canvas)
sliderwin2=ControlWindow.new(0,0,320,32*5)
sliderwin2.viewport=canvas.viewport
sliderwin2.addSlider(_INTL("Primer Cuadro:"),1,canvas.animation.length,1)
sliderwin2.addSlider(_INTL("Último Cuadro:"),1,canvas.animation.length,canvas.animation.length)
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
sliderwin2.opacity=200
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
startframe=sliderwin2.value(0)-1
endframe=sliderwin2.value(1)-1
for i in startframe..endframe
canvas.clearFrame(i)
end
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
return
end
|
#pbClosestHiddenItem ⇒ Object
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
|
# File 'scripts/PItem_Items.rb', line 474
def pbClosestHiddenItem
result = []
playerX=$game_player.x
playerY=$game_player.y
for event in $game_map.events.values
next if event.name!="HiddenItem"
next if (playerX-event.x).abs>=8
next if (playerY-event.y).abs>=6
next if $game_self_switches[[$game_map.map_id,event.id,"A"]]
result.push(event)
end
return nil if result.length==0
ret=nil
retmin=0
for event in result
dist=(playerX-event.x).abs+(playerY-event.y).abs
if !ret || retmin>dist
ret=event
retmin=dist
end
end
return ret
end
|
#pbCommands2(cmdwindow, commands, cmdIfCancel, defaultindex = -1,, noresize = false) ⇒ Object
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
|
# File 'scripts/Editor.rb', line 1139
def pbCommands2(cmdwindow,commands,cmdIfCancel,defaultindex=-1,noresize=false)
cmdwindow.z=99999
cmdwindow.visible=true
cmdwindow.commands=commands
if !noresize
cmdwindow.width=256
else
cmdwindow.height=Graphics.height
end
cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height
cmdwindow.x=0
cmdwindow.y=0
cmdwindow.active=true
cmdwindow.index=defaultindex if defaultindex>=0
ret=0
command=0
loop do
Graphics.update
Input.update
cmdwindow.update
if Input.trigger?(Input::B)
if cmdIfCancel>0
command=cmdIfCancel-1
break
elsif cmdIfCancel<0
command=cmdIfCancel
break
end
end
if Input.trigger?(Input::C) || (cmdwindow.doubleclick? rescue false)
command=cmdwindow.index
break
end
end
ret=command
cmdwindow.active=false
return ret
end
|
#pbCommands3(cmdwindow, commands, cmdIfCancel, defaultindex = -1,, noresize = false) ⇒ Object
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
|
# File 'scripts/Editor.rb', line 1178
def pbCommands3(cmdwindow,commands,cmdIfCancel,defaultindex=-1,noresize=false)
cmdwindow.z=99999
cmdwindow.visible=true
cmdwindow.commands=commands
if !noresize
cmdwindow.width=256
else
cmdwindow.height=Graphics.height
end
cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height
cmdwindow.x=0
cmdwindow.y=0
cmdwindow.active=true
cmdwindow.index=defaultindex if defaultindex>=0
ret=[]
command=0
loop do
Graphics.update
Input.update
cmdwindow.update
if Input.trigger?(Input::X)
command=[5,cmdwindow.index]
break
end
if Input.press?(Input::A)
if Input.repeat?(Input::UP)
command=[1,cmdwindow.index]
break
elsif Input.repeat?(Input::DOWN)
command=[2,cmdwindow.index]
break
elsif Input.press?(Input::LEFT)
command=[3,cmdwindow.index]
break
elsif Input.press?(Input::RIGHT)
command=[4,cmdwindow.index]
break
end
end
if Input.trigger?(Input::B)
if cmdIfCancel>0
command=[0,cmdIfCancel-1]
break
elsif cmdIfCancel<0
command=[0,cmdIfCancel]
break
end
end
if Input.trigger?(Input::C) || (cmdwindow.doubleclick? rescue false)
command=[0,cmdwindow.index]
break
end
end
ret=command
cmdwindow.active=false
return ret
end
|
#pbCompileAbilities ⇒ Object
Compilación de las habilidades
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
|
# File 'scripts/Compiler.rb', line 1387
def pbCompileAbilities
records=[]
movenames=[]
movedescs=[]
maxValue=0
pbCompilerEachPreppedLine("PBS/abilities.txt"){|line,lineno|
record=pbGetCsvRecord(line,lineno,[0,"vnss"])
movenames[record[0]]=record[2]
movedescs[record[0]]=record[3]
maxValue=[maxValue,record[0]].max
records.push(record)
}
MessageTypes.setMessages(MessageTypes::Abilities,movenames)
MessageTypes.setMessages(MessageTypes::AbilityDescs,movedescs)
code="class PBAbilities\r\n"
for rec in records
code+="#{rec[1]}=#{rec[0]}\r\n"
end
code+="\r\ndef PBAbilities.getName(id)\r\nreturn pbGetMessage(MessageTypes::Abilities,id)\r\nend"
code+="\r\ndef PBAbilities.getCount\r\nreturn #{records.length}\r\nend\r\n"
code+="\r\ndef PBAbilities.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
eval(code)
pbAddScript(code,"PBAbilities")
end
|
#pbCompileAllData(mustcompile) ⇒ Object
Compilación de todos los datos
#pbCompileAnimations ⇒ Object
Compilación de las animaciones de batalla
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
|
# File 'scripts/Compiler.rb', line 2662
def pbCompileAnimations
begin
if $RPGVX
pbanims=load_data("Data/PkmnAnimations.rvdata")
else
pbanims=load_data("Data/PkmnAnimations.rxdata")
end
rescue
pbanims=PBAnimations.new
end
move2anim=[[],[]]
=begin
if $RPGVX
anims=load_data("Data/Animations.rvdata")
else
anims=load_data("Data/Animations.rxdata")
end
for anim in anims
next if !anim || anim.frames.length==1
found=false
for i in 0...pbanims.length
if pbanims[i] && pbanims[i].id==anim.id
found=true if pbanims[i].array.length>1
break
end
end
if !found
pbanims[anim.id]=pbConvertRPGAnimation(anim)
end
end
=end
for i in 0...pbanims.length
next if !pbanims[i]
if pbanims[i].name[/^OppMove\:\s*(.*)$/]
if Kernel.hasConst?(PBMoves,$~[1])
moveid=PBMoves.const_get($~[1])
move2anim[1][moveid]=i
end
elsif pbanims[i].name[/^Move\:\s*(.*)$/]
if Kernel.hasConst?(PBMoves,$~[1])
moveid=PBMoves.const_get($~[1])
move2anim[0][moveid]=i
end
end
end
save_data(move2anim,"Data/move2anim.dat")
save_data(pbanims,"Data/PkmnAnimations.rxdata")
end
|
#pbCompileBerryPlants ⇒ Object
Compilación de las plantas de bayas
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
|
# File 'scripts/Compiler.rb', line 1653
def pbCompileBerryPlants
sections=[]
if File.exists?("PBS/berryplants.txt")
("PBS/berryplants.txt"){|line,lineno|
if line[ /^([^=]+)=(.*)$/ ]
key=$1
value=$2
value=value.split(",")
for i in 0...value.length
value[i].sub!(/^\s*/){}
value[i].sub!(/\s*$/){}
value[i]=value[i].to_i
end
item=parseItem(key)
sections[item]=value
end
}
end
save_data(sections,"Data/berryplants.dat")
end
|
#pbCompileBTTrainers(filename) ⇒ Object
Compilación de los entrenadores/Pokémon de la Torre de Batalla y las demás Copas
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
|
# File 'scripts/Compiler.rb', line 2416
def pbCompileBTTrainers(filename)
sections=[]
btTrainersRequiredTypes={
"Type"=>[0,"e",PBTrainers],
"Name"=>[1,"s"],
"BeginSpeech"=>[2,"s"],
"EndSpeechWin"=>[3,"s"],
"EndSpeechLose"=>[4,"s"],
"PokemonNos"=>[5,"*u"]
}
requiredtypes=btTrainersRequiredTypes
trainernames=[]
beginspeech=[]
endspeechwin=[]
endspeechlose=[]
if safeExists?(filename)
File.open(filename,"rb"){|f|
FileLineData.file=filename
pbEachFileSectionEx(f){|section,name|
rsection=[]
for key in section.keys
FileLineData.setSection(name,key,section[key])
schema=requiredtypes[key]
next if !schema
record=pbGetCsvRecord(section[key],0,schema)
rsection[schema[0]]=record
end
trainernames.push(rsection[1])
beginspeech.push(rsection[2])
endspeechwin.push(rsection[3])
endspeechlose.push(rsection[4])
sections.push(rsection)
}
}
end
MessageTypes.addMessagesAsHash(MessageTypes::TrainerNames,trainernames)
MessageTypes.addMessagesAsHash(MessageTypes::BeginSpeech,beginspeech)
MessageTypes.addMessagesAsHash(MessageTypes::EndSpeechWin,endspeechwin)
MessageTypes.addMessagesAsHash(MessageTypes::EndSpeechLose,endspeechlose)
return sections
end
|
#pbCompileConnections ⇒ Object
Compilación de las conexiones de los mapas
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
|
# File 'scripts/Compiler.rb', line 1341
def pbCompileConnections
records=[]
constants=""
itemnames=[]
pbCompilerEachPreppedLine("PBS/connections.txt"){|line,lineno|
hashenum={
"N"=>"N","North"=>"N",
"E"=>"E","East"=>"E",
"S"=>"S","South"=>"S",
"W"=>"W","West"=>"W"
}
record=[]
thisline=line.dup
record.push(csvInt!(thisline,lineno))
record.push(csvEnumFieldOrInt!(thisline,hashenum,"",sprintf("(line %d)",lineno)))
record.push(csvInt!(thisline,lineno))
record.push(csvInt!(thisline,lineno))
record.push(csvEnumFieldOrInt!(thisline,hashenum,"",sprintf("(line %d)",lineno)))
record.push(csvInt!(thisline,lineno))
if !pbRgssExists?(sprintf("Data/Map%03d.rxdata",record[0])) &&
!pbRgssExists?(sprintf("Data/Map%03d.rvdata",record[0]))
print _INTL("Aviso: El mapa {1}, mencionado en los datos\r\nde conexiones de mapas, no ha sido encontrado.\r\n{2}",record[0],FileLineData.linereport)
end
if !pbRgssExists?(sprintf("Data/Map%03d.rxdata",record[3])) &&
!pbRgssExists?(sprintf("Data/Map%03d.rvdata",record[3]))
print _INTL("Aviso: El mapa {1}, mencionado en los datos\r\nde conexiones de mapas, no ha sido encontrado.\r\n{2}",record[3],FileLineData.linereport)
end
case record[1]
when "N"
raise _INTL("El lado Norte del primer mapa debe conectarse con el lado Sur del segundo\r\n{1}",FileLineData.linereport) if record[4]!="S"
when "S"
raise _INTL("El lado Sur del primer mapa debe conectarse con el lado Norte del segundo\r\n{1}",FileLineData.linereport) if record[4]!="N"
when "E"
raise _INTL("El lado Este del primer mapa debe conectarse con el lado Oeste del segundo\r\n{1}",FileLineData.linereport) if record[4]!="W"
when "W"
raise _INTL("El lado Oeste del primer mapa debe conectarse con el lado Este del segundo\r\n{1}",FileLineData.linereport) if record[4]!="E"
end
records.push(record)
}
save_data(records,"Data/connections.dat")
Graphics.update
end
|
#pbCompileEncounters ⇒ Object
Compilación de los encuentros con Pokémon salvajes
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
|
# File 'scripts/Compiler.rb', line 2529
def pbCompileEncounters
lines=[]
linenos=[]
FileLineData.file="PBS/encounters.txt"
File.open("PBS/encounters.txt","rb"){|f|
lineno=1
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
line=prepline(line)
if line.length!=0
lines[lines.length]=line
linenos[linenos.length]=lineno
end
lineno+=1
}
}
encounters={}
thisenc=nil
lastenc=-1
lastenclen=0
needdensity=false
lastmapid=-1
i=0;
while i<lines.length
line=lines[i]
FileLineData.setLine(line,linenos[i])
mapid=line[/^\d+$/]
if mapid
lastmapid=mapid
if thisenc && (thisenc[1][EncounterTypes::Land] ||
thisenc[1][EncounterTypes::LandMorning] ||
thisenc[1][EncounterTypes::LandDay] ||
thisenc[1][EncounterTypes::LandNight] ||
thisenc[1][EncounterTypes::BugContest]) &&
thisenc[1][EncounterTypes::Cave]
raise _INTL("No se pueden definir encuentros en Campo y Cueva en la misma área (mapa ID {1})",mapid)
end
thisenc=[EncounterTypes::EnctypeDensities.clone,[]]
encounters[mapid.to_i]=thisenc
needdensity=true
i+=1
next
end
enc=findIndex(EncounterTypes::Names){|val| val==line}
if enc>=0
needdensity=false
enclines=EncounterTypes::EnctypeChances[enc].length
encarray=[]
j=i+1; k=0
while j<lines.length && k<enclines
line=lines[j]
FileLineData.setLine(lines[j],linenos[j])
splitarr=strsplit(line,/\s*,\s*/)
if !splitarr || splitarr.length<2
raise _INTL("En encounters.txt, se esperaba un línea de especies,\r\npero se obtuvo \"{1}\" (posiblemente hay muy pocas entradas en un tipo de encuentro).\r\nVerifica el formato de la sección enumerada con {2},\r\nque se encuentra justo antes de esta línea.\r\n{3}",
line,lastmapid,FileLineData.linereport)
end
splitarr[2]=splitarr[1] if splitarr.length==2
splitarr[1]=splitarr[1].to_i
splitarr[2]=splitarr[2].to_i
maxlevel=PBExperience::MAXLEVEL
if splitarr[1]<=0 || splitarr[1]>maxlevel
raise _INTL("El número de nivel no es válido: {1}\r\n{2}",splitarr[1],FileLineData.linereport)
end
if splitarr[2]<=0 || splitarr[2]>maxlevel
raise _INTL("El número de nivel no es válido: {1}\r\n{2}",splitarr[2],FileLineData.linereport)
end
if splitarr[1]>splitarr[2]
raise _INTL("El nivel mínimo es mayor que el nivel máximo: {1}\r\n{2}",line,FileLineData.linereport)
end
splitarr[0]=parseSpecies(splitarr[0])
linearr=splitarr
encarray.push(linearr)
thisenc[1][enc]=encarray
j+=1
k+=1
end
if j==lines.length && k<enclines
raise _INTL("Se encontró fin de archivo inesperado. Hay muy pocas entradas en la última sección, se esperaban {1} entradas.\r\nVerifica el formato de la sección número {2}.\r\n{3}",
enclines,lastmapid,FileLineData.linereport)
end
i=j
elsif needdensity
needdensity=false
nums=strsplit(line,/,/)
if nums && nums.length>=3
for j in 0...EncounterTypes::EnctypeChances.length
next if !EncounterTypes::EnctypeChances[j] ||
EncounterTypes::EnctypeChances[j].length==0
next if EncounterTypes::EnctypeCompileDens[j]==0
thisenc[0][j]=nums[EncounterTypes::EnctypeCompileDens[j]-1].to_i
end
else
raise _INTL("Sintaxis de densidades errónea en encounters.txt; se obtuvo \"{1}\"\r\n{2}",line,FileLineData.linereport)
end
i+=1
else
raise _INTL("Tipo de encuentro indefinido {1}, se esperaba uno de los siguientes:\r\n{2}\r\n{3}",
line,EncounterTypes::Names.inspect,FileLineData.linereport)
end
end
save_data(encounters,"Data/encounters.dat")
end
|
#pbCompileItems ⇒ Object
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
|
# File 'scripts/Compiler.rb', line 1604
def pbCompileItems
records=[]
constants=""
itemnames=[]
itempluralnames=[]
itemdescs=[]
maxValue=0
("PBS/items.txt"){|line,lineno|
linerecord=pbGetCsvRecord(line,lineno,[0,"vnssuusuuUN"])
record=SerialRecord.new
record[ITEMID] = linerecord[0]
constant=linerecord[1]
constants+="#{constant}=#{record[0]}\r\n"
record[ITEMNAME] = linerecord[2]
itemnames[record[0]]=linerecord[2]
record[ITEMPLURAL] = linerecord[3]
itempluralnames[record[0]]=linerecord[3]
record[ITEMPOCKET] = linerecord[4]
record[ITEMPRICE] = linerecord[5]
record[ITEMDESC] = linerecord[6]
itemdescs[record[0]]=linerecord[6]
record[ITEMUSE] = linerecord[7]
record[ITEMBATTLEUSE] = linerecord[8]
record[ITEMTYPE] = linerecord[9]
if linerecord[9]!="" && linerecord[10]
record[ITEMMACHINE] = parseMove(linerecord[10])
else
record[ITEMMACHINE] = 0
end
maxValue=[maxValue,record[0]].max
records.push(record)
}
MessageTypes.setMessages(MessageTypes::Items,itemnames)
MessageTypes.setMessages(MessageTypes::ItemPlurals,itempluralnames)
MessageTypes.setMessages(MessageTypes::ItemDescriptions,itemdescs)
writeSerialRecords("Data/items.dat",records)
code="class PBItems\r\n#{constants}"
code+="\r\ndef PBItems.getName(id)\r\nreturn pbGetMessage(MessageTypes::Items,id)\r\nend\r\n"
code+="\r\ndef PBItems.getNamePlural(id)\r\nreturn pbGetMessage(MessageTypes::ItemPlurals,id)\r\nend\r\n"
code+="\r\ndef PBItems.getCount\r\nreturn #{records.length}\r\nend\r\n"
code+="\r\ndef PBItems.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
eval(code)
pbAddScript(code,"PBItems")
Graphics.update
end
|
#pbCompileMachines ⇒ Object
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
|
# File 'scripts/Compiler.rb', line 2029
def pbCompileMachines
lineno=1
havesection=false
sectionname=nil
sections=[]
if safeExists?("PBS/tm.txt")
f=File.open("PBS/tm.txt","rb")
FileLineData.file="PBS/tm.txt"
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
FileLineData.setLine(line,lineno)
if !line[/^\#/] && !line[/^\s*$/]
if line[/^\s*\[\s*(.*)\s*\]\s*$/]
sectionname=parseMove($~[1])
sections[sectionname]=WordArray.new
havesection=true
else
if sectionname==nil
raise _INTL("Se esperaba una sección al inicio del archivo. Este error también puede ocurrir si el archivo no ha sido guardado en codificación UTF-8.\r\n{1}",FileLineData.linereport)
end
specieslist=line.sub(/\s+$/,"").split(",")
for species in specieslist
next if !species || species==""
sec=sections[sectionname]
sec[sec.length]=parseSpecies(species)
end
end
end
lineno+=1
if lineno%500==0
Graphics.update
end
if lineno%50==0
Win32API.SetWindowText(_INTL("Procesando linea {1}",lineno))
end
}
f.close
elsif safeExists?("Data/tmRS.dat")
tmrs=pbTMRS()
for i in 0...58
next if !tmrs[i] || tmrs[i]==0
sections[tmrs[i]]=[]
end
File.open("Data/tmRS.dat","rb"){|f|
species=1
while !f.eof?
data=f.read(8)+"\0\0\0\0\0\0\0\0"
for i in 0...58
next if !tmrs[i] || tmrs[i]==0
if (data[i>>3]&(1<<(i&7)))!=0
sections[tmrs[i]].push(species)
end
end
species+=1
end
}
end
save_data(sections,"Data/tm.dat")
end
|
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
|
# File 'scripts/Compiler.rb', line 2371
def pbCompileMetadata
sections=[]
currentmap=-1
("PBS/metadata.txt") {|line,lineno|
if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
sectionname=$~[1]
if currentmap==0
if sections[currentmap][MetadataHome]==nil
raise _INTL("Los datos de la Casa son necesarios en la sección metadata.txt [{1}]",sectionname)
end
if sections[currentmap][MetadataPlayerA]==nil
raise _INTL("Los datos de PlayerA son necesarios en la sección metadata.txt [{1}]",sectionname)
end
end
currentmap=sectionname.to_i
sections[currentmap]=[]
else
if currentmap<0
raise _INTL("Se esperaba una sección al inicio del archivo\r\n{1}",FileLineData.linereport)
end
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
raise _INTL("Sintaxis de línea errónea (se esperaba línea con formato XXX=YYY)\r\n{1}",FileLineData.linereport)
end
matchData=$~
schema=nil
FileLineData.setSection(currentmap,matchData[1],matchData[2])
if currentmap==0
schema=PokemonMetadata::GlobalTypes[matchData[1]]
else
schema=PokemonMetadata::NonGlobalTypes[matchData[1]]
end
if schema
record=pbGetCsvRecord(matchData[2],lineno,schema)
sections[currentmap][schema[0]]=record
end
end
}
File.open("Data/metadata.dat","wb"){|f|
Marshal.dump(sections,f)
}
end
|
#pbCompileMoves ⇒ Object
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
|
# File 'scripts/Compiler.rb', line 1444
def pbCompileMoves
records=[]
movenames=[]
movedescs=[]
movedata=[]
maxValue=0
pbCompilerEachPreppedLine("PBS/moves.txt"){|line,lineno|
thisline=line.clone
record=[]
flags=0
begin
record=pbGetCsvRecord(line,lineno,[0,"vnsxueeuuuxiss",
nil,nil,nil,nil,nil,PBTypes,["Physical","Special","Status"],
nil,nil,nil,nil,nil,nil,nil
])
pbCheckWord(record[3],_INTL("Function code"))
flags|=1 if record[12][/a/]
flags|=2 if record[12][/b/]
flags|=4 if record[12][/c/]
flags|=8 if record[12][/d/]
flags|=16 if record[12][/e/]
flags|=32 if record[12][/f/]
flags|=64 if record[12][/g/]
flags|=128 if record[12][/h/]
flags|=256 if record[12][/i/]
flags|=512 if record[12][/j/]
flags|=1024 if record[12][/k/]
flags|=2048 if record[12][/l/]
flags|=4096 if record[12][/m/]
flags|=8192 if record[12][/n/]
flags|=16384 if record[12][/o/]
flags|=32768 if record[12][/p/]
rescue
oldmessage=$!.message
raise if !pbRgssExists?("Data/rsattacks.dat")
begin
oldrecord=pbGetCsvRecord(thisline,lineno,[0,"unss",nil,nil,nil,nil])
rescue
raise $!.message+"\r\n"+oldmessage
end
oldmovedata=PBMoveDataOld.new(oldrecord[0])
flags=oldmovedata.flags
record=[oldrecord[0],oldrecord[1],oldrecord[2],
oldmovedata.function,
oldmovedata.basedamage,
oldmovedata.type,
oldmovedata.category,
oldmovedata.accuracy,
oldmovedata.totalpp,
oldmovedata.addlEffect,
oldmovedata.target,
oldmovedata.priority,
oldmovedata.flags,
0, oldrecord[3]]
end
pbCheckWord(record[3],_INTL("Function code"))
pbCheckByte(record[4],_INTL("Base damage"))
if record[6]==2 && record[4]!=0
raise _INTL("Los movimientos de Estado deben tener daño base de 0, use Físico o Especial\r\n{1}",FileLineData.linereport)
end
if record[6]!=2 && record[4]==0
print _INTL("Aviso: Los movimientos Físicos o Especiales no pueden tener daño base de 0, se cambia a movimientos de Estado\r\n{1}",FileLineData.linereport)
record[6]=2
end
pbCheckByte(record[7],_INTL("Accuracy"))
pbCheckByte(record[8],_INTL("Total PP"))
pbCheckByte(record[9],_INTL("Additional Effect"))
pbCheckWord(record[10],_INTL("Target"))
pbCheckSignedByte(record[11],_INTL("Priority"))
maxValue=[maxValue,record[0]].max
movedata[record[0]]=[
record[3], record[4], record[5], record[6], record[7], record[8], record[9], record[10], record[11], flags, 0 ].pack("vCCCCCCvCvC")
movenames[record[0]]=record[2] movedescs[record[0]]=record[13] records.push(record)
}
defaultdata=[0,0,0,0,0,0,0,0,0,0,0].pack("vCCCCCCvCvC")
File.open("Data/moves.dat","wb"){|file|
for i in 0...movedata.length
file.write(movedata[i] ? movedata[i] : defaultdata)
end
}
MessageTypes.setMessages(MessageTypes::Moves,movenames)
MessageTypes.setMessages(MessageTypes::MoveDescriptions,movedescs)
code="class PBMoves\r\n"
for rec in records
code+="#{rec[1]}=#{rec[0]}\r\n"
end
code+="\r\ndef PBMoves.getName(id)\r\nreturn pbGetMessage(MessageTypes::Moves,id)\r\nend"
code+="\r\ndef PBMoves.getCount\r\nreturn #{records.length}\r\nend"
code+="\r\ndef PBMoves.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
eval(code)
pbAddScript(code,"PBMoves")
end
|
#pbCompilePhoneData ⇒ Object
Compilación de los mensajes del celular
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
|
# File 'scripts/Compiler.rb', line 2330
def pbCompilePhoneData
return if !safeExists?("PBS/phone.txt")
database=PhoneDatabase.new
sections=[]
File.open("PBS/phone.txt","rb"){|f|
pbEachSection(f){|section,name|
if name=="<Generics>"
database.generics=section
sections.concat(section)
elsif name=="<BattleRequests>"
database.battleRequests=section
sections.concat(section)
elsif name=="<GreetingsMorning>"
database.greetingsMorning=section
sections.concat(section)
elsif name=="<GreetingsEvening>"
database.greetingsEvening=section
sections.concat(section)
elsif name=="<Greetings>"
database.greetings=section
sections.concat(section)
elsif name=="<Bodies1>"
database.bodies1=section
sections.concat(section)
elsif name=="<Bodies2>"
database.bodies2=section
sections.concat(section)
end
}
}
MessageTypes.setMessagesAsHash(MessageTypes::PhoneMessages,sections)
save_data(database,"Data/phone.dat")
end
|
#pbCompilePokemonData ⇒ Object
Compilación de los Pokémon
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
|
# File 'scripts/Compiler.rb', line 1677
def pbCompilePokemonData
sections=[]
requiredtypes={
"Name"=>[0,"s"],
"Kind"=>[0,"s"],
"InternalName"=>[0,"c"],
"Pokedex"=>[0,"S"],
"Moves"=>[0,"*uE",nil,PBMoves],
"Color"=>[6,"e",PBColors],
"Type1"=>[8,"e",PBTypes],
"BaseStats"=>[10,"uuuuuu"],
"Rareness"=>[16,"u"],
"GenderRate"=>[18,"e",{"AlwaysMale"=>0,"FemaleOneEighth"=>31,
"Female25Percent"=>63,"Female50Percent"=>127,"Female75Percent"=>191,
"FemaleSevenEighths"=>223,"AlwaysFemale"=>254,"Genderless"=>255}],
"Happiness"=>[19,"u"],
"GrowthRate"=>[20,"e",{"Medium"=>0,"MediumFast"=>0,"Erratic"=>1,
"Fluctuating"=>2,"Parabolic"=>3,"MediumSlow"=>3,"Fast"=>4,"Slow"=>5}],
"StepsToHatch"=>[21,"w"],
"EffortPoints"=>[23,"uuuuuu"],
"Compatibility"=>[31,"eg",PBEggGroups,PBEggGroups],
"Height"=>[33,"f"],
"Weight"=>[35,"f"],
"BaseEXP"=>[38,"w"],
}
optionaltypes={
"BattlerPlayerY"=>[0,"i"],
"BattlerEnemyY"=>[0,"i"],
"BattlerAltitude"=>[0,"i"],
"EggMoves"=>[0,"*E",PBMoves],
"FormNames"=>[0,"S"],
"RegionalNumbers"=>[0,"*w"],
"Evolutions"=>[0,"*ses",nil,PBEvolution],
"Abilities"=>[2,"EG",PBAbilities,PBAbilities],
"Habitat"=>[7,"e",["","Grassland","Forest","WatersEdge","Sea","Cave","Mountain","RoughTerrain","Urban","Rare"]],
"Type2"=>[9,"e",PBTypes],
"HiddenAbility"=>[40,"EGGG",PBAbilities,PBAbilities,PBAbilities,PBAbilities],
"WildItemCommon"=>[48,"E",PBItems],
"WildItemUncommon"=>[50,"E",PBItems],
"WildItemRare"=>[52,"E",PBItems],
"Incense"=>[54,"E",PBItems]
}
currentmap=-1
dexdatas=[]
eggmoves=[]
entries=[]
kinds=[]
speciesnames=[]
moves=[]
evolutions=[]
regionals=[]
formnames=[]
metrics=[SignedWordArray.new,SignedWordArray.new,SignedWordArray.new]
constants=""
maxValue=0
File.open("PBS/pokemon.txt","rb"){|f|
FileLineData.file="PBS/pokemon.txt"
pbEachFileSection(f){|lastsection,currentmap|
dexdata=[]
for i in 0...76
dexdata[i]=0
end
thesemoves=[]
theseevos=[]
if !lastsection["Type2"] || lastsection["Type2"]==""
if !lastsection["Type1"] || lastsection["Type1"]==""
raise _INTL("No se ha definido el tipo del Pokémon en la sección {2} (PBS/pokemon.txt)",key,sectionDisplay) if hash==requiredtypes
next
end
lastsection["Type2"]=lastsection["Type1"].clone
end
[requiredtypes,optionaltypes].each{|hash|
for key in hash.keys
FileLineData.setSection(currentmap,key,lastsection[key])
maxValue=[maxValue,currentmap].max
sectionDisplay=currentmap.to_s
next if hash[key][0]<0
if currentmap==0
raise _INTL("Una especie Pokemon no puede ser enumerada en 0 (PBS/pokemon.txt)")
end
if !lastsection[key] || lastsection[key]==""
raise _INTL("Un valor obligatorio {1} no ha sido encontrado o está en blanco en la sección {2} (PBS/pokemon.txt)",key,sectionDisplay) if hash==requiredtypes
next
end
secvalue=lastsection[key]
rtschema=hash[key]
schema=hash[key][1]
valueindex=0
loop do
offset=0
for i in 0...schema.length
next if schema[i,1]=="*"
minus1=(schema[0,1]=="*") ? -1 : 0
if (schema[i,1]=="g" || schema[i,1]=="G") && secvalue==""
if key=="Compatibility"
dexdata[rtschema[0]+offset]=dexdata[rtschema[0]]
end
break
end
case schema[i,1]
when "e", "g"
value=csvEnumField!(secvalue,rtschema[2+i+minus1],key,sectionDisplay)
bytes=1
when "E", "G"
value=csvEnumField!(secvalue,rtschema[2+i+minus1],key,sectionDisplay)
bytes=2
when "i"
value=csvInt!(secvalue,key)
bytes=1
when "u"
value=csvPosInt!(secvalue,key)
bytes=1
when "w"
value=csvPosInt!(secvalue,key)
bytes=2
when "f"
value=csvFloat!(secvalue,key,sectionDisplay)
value=(value*10).round
if value<=0
raise _INTL("El valor '{1}' no puede ser menor que o igual a 0 (sección {2}, PBS/pokemon.txt)",key,currentmap)
end
bytes=2
when "c", "s"
value=csvfield!(secvalue)
when "S"
value=secvalue
secvalue=""
end
if key=="EggMoves"
eggmoves[currentmap]=[] if !eggmoves[currentmap]
eggmoves[currentmap].push(value)
elsif key=="Moves"
thesemoves.push(value)
elsif key=="RegionalNumbers"
regionals[valueindex]=[] if !regionals[valueindex]
regionals[valueindex][currentmap]=value
elsif key=="Evolutions"
theseevos.push(value)
elsif key=="InternalName"
raise _INTL("Nombre interno inválido: {1} (sección {2}, PBS/pokemon.txt)",value,currentmap) if !value[/^(?![0-9])\w*$/]
constants+="#{value}=#{currentmap}\r\n"
elsif key=="Kind"
raise _INTL("La clase {1} tiene más de 20 caracteres de longitud (sección {2}, PBS/pokemon.txt)",value,currentmap) if value.length>20
kinds[currentmap]=value
elsif key=="Pokedex"
entries[currentmap]=value
elsif key=="BattlerPlayerY"
pbCheckSignedWord(value,key)
metrics[0][currentmap]=value
elsif key=="BattlerEnemyY"
pbCheckSignedWord(value,key)
metrics[1][currentmap]=value
elsif key=="BattlerAltitude"
pbCheckSignedWord(value,key)
metrics[2][currentmap]=value
elsif key=="Name"
raise _INTL("El nombre de la especie {1} tiene más de 20 caracteres de longitud (sección {2}, PBS/pokemon.txt)",value,currentmap) if value.length>20
speciesnames[currentmap]=value
elsif key=="FormNames"
formnames[currentmap]=value
else
dexdata[rtschema[0]+offset]=value&0xFF
dexdata[rtschema[0]+1+offset]=(value>>8)&0xFF if bytes>1
offset+=bytes
end
valueindex+=1
end
break if secvalue==""
break if schema[0,1]!="*"
end
end
}
movelist=[]
evolist=[]
for i in 0...thesemoves.length/2
movelist.push([thesemoves[i*2],thesemoves[i*2+1],i])
end
movelist.sort!{|a,b| a[0]==b[0] ? a[2]<=>b[2] : a[0]<=>b[0]}
for i in movelist; i.pop; end
for i in 0...theseevos.length/3
evolist.push([theseevos[i*3],theseevos[i*3+1],theseevos[i*3+2]])
end
moves[currentmap]=movelist
evolutions[currentmap]=evolist
dexdatas[currentmap]=dexdata
}
}
if dexdatas.length==0
raise _INTL("No se han definido especies de Pokémon en pokemon.txt")
end
count=dexdatas.compact.length
code="module PBSpecies\r\n#{constants}"
for i in 0...speciesnames.length
speciesnames[i]="????????" if !speciesnames[i]
end
code+="def PBSpecies.getName(id)\r\nreturn pbGetMessage(MessageTypes::Species,id)\r\nend\r\n"
code+="def PBSpecies.getCount\r\nreturn #{count}\r\nend\r\n"
code+="def PBSpecies.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
eval(code)
pbAddScript(code,"PBSpecies")
for e in 0...evolutions.length
evolist=evolutions[e]
next if !evolist
for i in 0...evolist.length
FileLineData.setSection(i,"Evolutions","")
evonib=evolist[i][1]
evolist[i][0]=csvEnumField!(evolist[i][0],PBSpecies,"Evolutions",i)
case PBEvolution::EVOPARAM[evonib]
when 1
evolist[i][2]=csvPosInt!(evolist[i][2])
when 2
evolist[i][2]=csvEnumField!(evolist[i][2],PBItems,"Evolutions",i)
when 3
evolist[i][2]=csvEnumField!(evolist[i][2],PBMoves,"Evolutions",i)
when 4
evolist[i][2]=csvEnumField!(evolist[i][2],PBSpecies,"Evolutions",i)
when 5
evolist[i][2]=csvEnumField!(evolist[i][2],PBTypes,"Evolutions",i)
else
evolist[i][2]=0
end
evolist[i][3]=0
end
end
_EVODATAMASK=0xC0
_EVONEXTFORM=0x00
_EVOPREVFORM=0x40
for e in 0...evolutions.length
evolist=evolutions[e]
next if !evolist
parent=nil
child=-1
for f in 0...evolutions.length
evolist=evolutions[f]
next if !evolist || e==f
for g in evolist
if g[0]==e && (g[3]&_EVODATAMASK)==_EVONEXTFORM
parent=g
child=f
break
end
end
break if parent
end
if parent
evolutions[e]=[[child,parent[1],parent[2],_EVOPREVFORM]].concat(evolutions[e])
end
end
metrics[0].fillNils(dexdatas.length,0) metrics[1].fillNils(dexdatas.length,0) metrics[2].fillNils(dexdatas.length,0) save_data(metrics,"Data/metrics.dat")
File.open("Data/regionals.dat","wb"){|f|
f.fputw(regionals.length)
f.fputw(dexdatas.length)
for i in 0...regionals.length
for j in 0...dexdatas.length
num=regionals[i][j]
num=0 if !num
f.fputw(num)
end
end
}
File.open("Data/evolutions.dat","wb"){|f|
mx=[maxValue,evolutions.length-1].max
offset=mx*8
for i in 1..mx
f.fputdw(offset)
f.fputdw(evolutions[i] ? evolutions[i].length*5 : 0)
offset+=evolutions[i] ? evolutions[i].length*5 : 0
end
for i in 1..mx
next if !evolutions[i]
for j in evolutions[i]
f.fputb(j[3]|j[1])
f.fputw(j[2])
f.fputw(j[0])
end
end
}
File.open("Data/dexdata.dat","wb"){|f|
mx=[maxValue,dexdatas.length-1].max
for i in 1..mx
if dexdatas[i]
dexdatas[i].each {|item| f.fputb(item)}
else
76.times { f.fputb(0) }
end
end
}
File.open("Data/eggEmerald.dat","wb"){|f|
mx=[maxValue,eggmoves.length-1].max
offset=mx*8
for i in 1..mx
f.fputdw(offset)
f.fputdw(eggmoves[i] ? eggmoves[i].length : 0)
offset+=eggmoves[i] ? eggmoves[i].length*2 : 0
end
for i in 1..mx
next if !eggmoves[i]
for j in eggmoves[i]
f.fputw(j)
end
end
}
MessageTypes.setMessages(MessageTypes::Species,speciesnames)
MessageTypes.setMessages(MessageTypes::Kinds,kinds)
MessageTypes.setMessages(MessageTypes::Entries,entries)
MessageTypes.setMessages(MessageTypes::FormNames,formnames)
File.open("Data/attacksRS.dat","wb"){|f|
mx=[maxValue,moves.length-1].max
offset=mx*8
for i in 1..mx
f.fputdw(offset)
f.fputdw(moves[i] ? moves[i].length*2 : 0)
offset+=moves[i] ? moves[i].length*4 : 0
end
for i in 1..mx
next if !moves[i]
for j in moves[i]
f.fputw(j[0])
f.fputw(j[1])
end
end
}
end
|
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# File 'scripts/Compiler.rb', line 267
def (filename)
File.open(filename,"rb"){|f|
FileLineData.file=filename
lineno=1
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
if !line[/^\#/] && !line[/^\s*$/]
FileLineData.setLine(line,lineno)
yield line, lineno
end
lineno+=1
}
}
end
|
#pbCompilerEachPreppedLine(filename) ⇒ Object
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'scripts/Compiler.rb', line 298
def pbCompilerEachPreppedLine(filename)
File.open(filename,"rb"){|f|
FileLineData.file=filename
lineno=1
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
line=prepline(line)
if !line[/^\#/] && !line[/^\s*$/]
FileLineData.setLine(line,lineno)
yield line, lineno
end
lineno+=1
}
}
end
|
#pbCompileShadowMoves ⇒ Object
Compilación de los movimientos Oscuros
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
|
# File 'scripts/Compiler.rb', line 2638
def pbCompileShadowMoves
sections=[]
if File.exists?("PBS/shadowmoves.txt")
("PBS/shadowmoves.txt"){|line,lineno|
if line[ /^([^=]+)=(.*)$/ ]
key=$1
value=$2
value=value.split(",")
species=parseSpecies(key)
moves=[]
for i in 0...[4,value.length].min
moves.push((parseMove(value[i]) rescue nil))
end
moves.compact!
sections[species]=moves if moves.length>0
end
}
end
save_data(sections,"Data/shadowmoves.dat")
end
|
#pbCompileText ⇒ Object
282
283
284
285
286
287
288
289
290
291
292
|
# File 'scripts/Intl_Messages.rb', line 282
def pbCompileText
outfile=File.open("intl.dat","wb")
begin
intldat=pbGetText("intl.txt")
Marshal.dump(intldat,outfile)
rescue
raise
ensure
outfile.close
end
end
|
#pbCompileTextUI ⇒ Object
#pbCompileTownMap ⇒ Object
Compilación de los puntos del mapa de pueblos
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
|
# File 'scripts/Compiler.rb', line 1285
def pbCompileTownMap
nonglobaltypes={
"Name"=>[0,"s"],
"Filename"=>[1,"s"],
"Point"=>[2,"uussUUUU"]
}
currentmap=-1
rgnnames=[]
placenames=[]
placedescs=[]
sections=[]
("PBS/townmap.txt"){|line,lineno|
if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
currentmap=$~[1].to_i
sections[currentmap]=[]
else
if currentmap<0
raise _INTL("Se esperaba una sección al inicio del archivo\r\n{1}",FileLineData.linereport)
end
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
raise _INTL("Sintaxis de línea errónea (se esperaba línea con formato XXX=YYY)\r\n{1}",FileLineData.linereport)
end
settingname=$~[1]
schema=nonglobaltypes[settingname]
if schema
record=pbGetCsvRecord($~[2],lineno,schema)
if settingname=="Name"
rgnnames[currentmap]=record
elsif settingname=="Point"
placenames.push(record[2])
placedescs.push(record[3])
sections[currentmap][schema[0]]=[] if !sections[currentmap][schema[0]]
sections[currentmap][schema[0]].push(record)
else sections[currentmap][schema[0]]=record
end
end
end
}
File.open("Data/townmap.dat","wb"){|f|
Marshal.dump(sections,f)
}
MessageTypes.setMessages(
MessageTypes::RegionNames,rgnnames
)
MessageTypes.setMessagesAsHash(
MessageTypes::PlaceNames,placenames
)
MessageTypes.setMessagesAsHash(
MessageTypes::PlaceDescriptions,placedescs
)
end
|
#pbCompileTrainerEvents(mustcompile) ⇒ Object
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
|
# File 'scripts/Compiler.rb', line 3080
def pbCompileTrainerEvents(mustcompile)
mapdata=MapData.new
t = Time.now.to_i
Graphics.update
trainerChecker=TrainerChecker.new
for id in mapdata.mapinfos.keys.sort
changed=false
map=mapdata.getMap(id)
next if !map || !mapdata.mapinfos[id]
Win32API.SetWindowText(_INTL("Procesando mapa {1} ({2})",id,mapdata.mapinfos[id].name))
for key in map.events.keys
if Time.now.to_i - t >= 5
Graphics.update
t = Time.now.to_i
end
newevent=pbConvertToTrainerEvent(map.events[key],trainerChecker)
if newevent
changed=true
map.events[key]=newevent
end
newevent=pbConvertToItemEvent(map.events[key])
if newevent
changed=true
map.events[key]=newevent
end
newevent=pbFixEventUse(map.events[key],id,mapdata)
if newevent
changed=true
map.events[key]=newevent
end
end
if Time.now.to_i - t >= 5
Graphics.update
t = Time.now.to_i
end
changed=true if pbCheckCounters(map,id,mapdata)
if changed
mapdata.saveMap(id)
mapdata.saveTilesets
end
end
changed=false
if Time.now.to_i-t>=5
Graphics.update
t=Time.now.to_i
end
commonEvents=pbLoadRxData("Data/CommonEvents")
Win32API.SetWindowText(_INTL("Procesando eventos comunes"))
for key in 0...commonEvents.length
newevent=pbFixEventUse(commonEvents[key],0,mapdata)
if newevent
changed=true
map.events[key]=newevent
end
end
if changed
if $RPGVX
save_data(commonEvents,"Data/CommonEvents.rvdata")
else
save_data(commonEvents,"Data/CommonEvents.rxdata")
end
end
end
|
#pbCompileTrainerLists ⇒ Object
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
|
# File 'scripts/Compiler.rb', line 2458
def pbCompileTrainerLists
btTrainersRequiredTypes={
"Trainers"=>[0,"s"],
"Pokemon"=>[1,"s"],
"Challenges"=>[2,"*s"]
}
if !safeExists?("PBS/trainerlists.txt")
File.open("PBS/trainerlists.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
f.write("[DefaultTrainerList]\r\nTrainers=bttrainers.txt\r\nPokemon=btpokemon.txt\r\n")
}
end
database=[]
sections=[]
MessageTypes.setMessagesAsHash(MessageTypes::BeginSpeech,[])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechWin,[])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose,[])
File.open("PBS/trainerlists.txt","rb"){|f|
FileLineData.file="PBS/trainerlists.txt"
pbEachFileSectionEx(f){|section,name|
next if name!="DefaultTrainerList" && name!="TrainerList"
rsection=[]
for key in section.keys
FileLineData.setSection(name,key,section[key])
schema=btTrainersRequiredTypes[key]
next if key=="Challenges" && name=="DefaultTrainerList"
next if !schema
record=pbGetCsvRecord(section[key],0,schema)
rsection[schema[0]]=record
end
if !rsection[0]
raise _INTL("No se ha indicado el archivo de datos de entrenadores en la sección {1}\r\n{2}",name,FileLineData.linereport)
end
if !rsection[1]
raise _INTL("No se ha indicado el archivo de datos de entrenadores en la sección {1}\r\n{2}",name,FileLineData.linereport)
end
rsection[3]=rsection[0]
rsection[4]=rsection[1]
rsection[5]=(name=="DefaultTrainerList")
if safeExists?("PBS/"+rsection[0])
rsection[0]=pbCompileBTTrainers("PBS/"+rsection[0])
else
rsection[0]=[]
end
if safeExists?("PBS/"+rsection[1])
filename="PBS/"+rsection[1]
rsection[1]=[]
(filename){|line,lineno|
rsection[1].push(PBPokemon.fromInspected(line))
}
else
rsection[1]=[]
end
if !rsection[2]
rsection[2]=[]
end
while rsection[2].include?("")
rsection[2].delete("")
end
rsection[2].compact!
sections.push(rsection)
}
}
save_data(sections,"Data/trainerlists.dat")
end
|
#pbCompileTrainers ⇒ Object
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
|
# File 'scripts/Compiler.rb', line 2123
def pbCompileTrainers
records=[]
trainernames=[]
count=0
maxValue=0
pbCompilerEachPreppedLine("PBS/trainertypes.txt"){|line,lineno|
record=pbGetCsvRecord(line,lineno,[0,"unsUSSSeUS", nil,nil,nil,nil,nil,nil,nil,{
""=>2,"Male"=>0,"M"=>0,"0"=>0,"Female"=>1,"F"=>1,"1"=>1,"Mixed"=>2,"X"=>2,"2"=>2
},nil,nil]
)
if record[3] && (record[3]<0 || record[3]>255)
raise _INTL("Cantidad de dinero errónea (debe ser entre 0 y 255)\r\n{1}",FileLineData.linereport)
end
record[3]=30 if !record[3]
if record[8] && (record[8]<0 || record[8]>255)
raise _INTL("Valor de destreza erróneo (debe ser entre 0 y 255)\r\n{1}",FileLineData.linereport)
end
record[8]=record[3] if !record[8]
if records[record[0]]
raise _INTL("Hay dos tipos de entrenadores ({1} y {2}) con el mismo ID ({3}), lo que no está permitido.\r\n{4}",
records[record[0]][1],record[1],record[0],FileLineData.linereport)
end
trainernames[record[0]]=record[2]
records[record[0]]=record
maxValue=[maxValue,record[0]].max
}
count=records.compact.length
MessageTypes.setMessages(MessageTypes::TrainerTypes,trainernames)
code="class PBTrainers\r\n"
for rec in records
next if !rec
code+="#{rec[1]}=#{rec[0]}\r\n"
end
code+="\r\ndef self.getName(id)\r\nreturn pbGetMessage(MessageTypes::TrainerTypes,id)\r\nend"
code+="\r\ndef self.getCount\r\nreturn #{count}\r\nend"
code+="\r\ndef self.maxValue\r\nreturn #{maxValue}\r\nend\r\nend"
eval(code)
pbAddScript(code,"PBTrainers")
File.open("Data/trainertypes.dat","wb"){|f|
Marshal.dump(records,f)
}
lines=[]
linenos=[]
lineno=1
File.open("PBS/trainers.txt","rb"){|f|
FileLineData.file="PBS/trainers.txt"
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
line=prepline(line)
if line!=""
lines.push(line)
linenos.push(lineno)
end
lineno+=1
}
}
nameoffset=0
trainers=[]
trainernames.clear
i=0; loop do break unless i<lines.length
FileLineData.setLine(lines[i],linenos[i])
trainername=parseTrainer(lines[i])
FileLineData.setLine(lines[i+1],linenos[i+1])
nameline=strsplit(lines[i+1],/\s*,\s*/)
name=nameline[0]
raise _INTL("El nombre del entrenador es muy largo\r\n{1}",FileLineData.linereport) if name.length>=0x10000
trainernames.push(name)
partyid=0
if nameline[1] && nameline[1]!=""
raise _INTL("Se esperaba un número para el ID de batalla del entrenador\r\n{1}",FileLineData.linereport) if !nameline[1][/^\d+$/]
partyid=nameline[1].to_i
end
FileLineData.setLine(lines[i+2],linenos[i+2])
items=strsplit(lines[i+2],/\s*,\s*/)
items[0].gsub!(/^\s+/,"") raise _INTL("Se esperaba un número para la cantidad de Pokémon\r\n{1}",FileLineData.linereport) if !items[0][/^\d+$/]
numpoke=items[0].to_i
realitems=[]
for j in 1...items.length realitems.push(parseItem(items[j])) if items[j] && items[j]!=""
end
pkmn=[]
for j in 0...numpoke
FileLineData.setLine(lines[i+j+3],linenos[i+j+3])
poke=strsplit(lines[i+j+3],/\s*,\s*/)
begin
poke[TPSPECIES]=parseSpecies(poke[TPSPECIES])
rescue
raise _INTL("Se esperaba un nombre de especie: {1}\r\n{2}",poke[0],FileLineData.linereport)
end
poke[TPLEVEL]=poke[TPLEVEL].to_i
raise _INTL("Nivel erróneo: {1} (debe estar entre 1-{2})\r\n{3}",poke[TPLEVEL],
PBExperience::MAXLEVEL,FileLineData.linereport) if poke[TPLEVEL]<=0 || poke[TPLEVEL]>PBExperience::MAXLEVEL
if !poke[TPITEM] || poke[TPITEM]==""
poke[TPITEM]=TPDEFAULTS[TPITEM]
else
poke[TPITEM]=parseItem(poke[TPITEM])
end
moves=[]
for j in [TPMOVE1,TPMOVE2,TPMOVE3,TPMOVE4]
moves.push(parseMove(poke[j])) if poke[j] && poke[j]!=""
end
for j in 0...4
index=[TPMOVE1,TPMOVE2,TPMOVE3,TPMOVE4][j]
if moves[j] && moves[j]!=0
poke[index]=moves[j]
else
poke[index]=TPDEFAULTS[index]
end
end
if !poke[TPABILITY] || poke[TPABILITY]==""
poke[TPABILITY]=TPDEFAULTS[TPABILITY]
else
poke[TPABILITY]=poke[TPABILITY].to_i
raise _INTL("Bandera de habilidad errónea: {1} (debe ser 0 o 1 o 2-5)\r\n{2}",poke[TPABILITY],FileLineData.linereport) if poke[TPABILITY]<0 || poke[TPABILITY]>5
end
if !poke[TPGENDER] || poke[TPGENDER]==""
poke[TPGENDER]=TPDEFAULTS[TPGENDER]
else
if poke[TPGENDER]=="M"
poke[TPGENDER]=0
elsif poke[TPGENDER]=="F"
poke[TPGENDER]=1
else
poke[TPGENDER]=poke[TPGENDER].to_i
raise _INTL("Bandera de género errónea: {1} (debe ser M o F, o 0 o 1)\r\n{2}",poke[TPGENDER],FileLineData.linereport) if poke[TPGENDER]<0 || poke[TPGENDER]>1
end
end
if !poke[TPFORM] || poke[TPFORM]==""
poke[TPFORM]=TPDEFAULTS[TPFORM]
else
poke[TPFORM]=poke[TPFORM].to_i
raise _INTL("Forma errónea: {1} (debe ser 0 o mayor)\r\n{2}",poke[TPFORM],FileLineData.linereport) if poke[TPFORM]<0
end
if !poke[TPSHINY] || poke[TPSHINY]==""
poke[TPSHINY]=TPDEFAULTS[TPSHINY]
elsif poke[TPSHINY]=="shiny"
poke[TPSHINY]=true
else
poke[TPSHINY]=csvBoolean!(poke[TPSHINY].clone)
end
if !poke[TPNATURE] || poke[TPNATURE]==""
poke[TPNATURE]=TPDEFAULTS[TPNATURE]
else
poke[TPNATURE]=parseNature(poke[TPNATURE])
end
if !poke[TPIV] || poke[TPIV]==""
poke[TPIV]=TPDEFAULTS[TPIV]
else
poke[TPIV]=poke[TPIV].to_i
raise _INTL("IV errónea: {1} (debe estar entre 0-31)\r\n{2}",poke[TPIV],FileLineData.linereport) if poke[TPIV]<0 || poke[TPIV]>31
end
if !poke[TPHAPPINESS] || poke[TPHAPPINESS]==""
poke[TPHAPPINESS]=TPDEFAULTS[TPHAPPINESS]
else
poke[TPHAPPINESS]=poke[TPHAPPINESS].to_i
raise _INTL("Felicidad errónea: {1} (debe estar entre 0-255)\r\n{2}",poke[TPHAPPINESS],FileLineData.linereport) if poke[TPHAPPINESS]<0 || poke[TPHAPPINESS]>255
end
if !poke[TPNAME] || poke[TPNAME]==""
poke[TPNAME]=TPDEFAULTS[TPNAME]
else
poke[TPNAME]=poke[TPNAME].to_s
raise _INTL("Apodo erróneo: {1} (debe ser de 1-20 caracteres)\r\n{2}",poke[TPNAME],FileLineData.linereport) if (poke[TPNAME].to_s).length>20
end
if !poke[TPSHADOW] || poke[TPSHADOW]==""
poke[TPSHADOW]=TPDEFAULTS[TPSHADOW]
else
poke[TPSHADOW]=csvBoolean!(poke[TPSHADOW].clone)
end
if !poke[TPBALL] || poke[TPBALL]==""
poke[TPBALL]=TPDEFAULTS[TPBALL]
else
poke[TPBALL]=poke[TPBALL].to_i
raise _INTL("Ball errónea: {1} (debe ser 0 o mayor)\r\n{2}",poke[TPBALL],FileLineData.linereport) if poke[TPBALL]<0
end
pkmn.push(poke)
end
i+=3+numpoke
MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames,trainernames)
trainers.push([trainername,name,realitems,pkmn,partyid])
nameoffset+=name.length
end
save_data(trainers,"Data/trainers.dat")
end
|
#pbCompileTypes ⇒ Object
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
|
# File 'scripts/Compiler.rb', line 1166
def pbCompileTypes
pbWriteDefaultTypes
sections=[]
typechart=[]
types=[]
nameToType={}
requiredtypes={
"Name"=>[1,"s"],
"InternalName"=>[2,"s"],
}
optionaltypes={
"IsPseudoType"=>[3,"b"],
"IsSpecialType"=>[4,"b"],
"Weaknesses"=>[5,"*s"],
"Resistances"=>[6,"*s"],
"Immunities"=>[7,"*s"]
}
currentmap=-1
foundtypes=[]
("PBS/types.txt") {|line,lineno|
if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
sectionname=$~[1]
if currentmap>=0
for reqtype in requiredtypes.keys
if !foundtypes.include?(reqtype)
raise _INTL("El valor obligatorio '{1}' no ha sido indicado en la sección '{2}'\r\n{3}",reqtype,currentmap,FileLineData.linereport)
end
end
foundtypes.clear
end
currentmap=sectionname.to_i
types[currentmap]=[currentmap,nil,nil,false,false,[],[],[]]
else
if currentmap<0
raise _INTL("Se esperaba una sección al inicio del archivo\r\n{1}",FileLineData.linereport)
end
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
raise _INTL("Sintaxis de línea errónea (se esperaba línea con formato XXX=YYY)\r\n{1}",FileLineData.linereport)
end
matchData=$~
schema=nil
FileLineData.setSection(currentmap,matchData[1],matchData[2])
if requiredtypes.keys.include?(matchData[1])
schema=requiredtypes[matchData[1]]
foundtypes.push(matchData[1])
else
schema=optionaltypes[matchData[1]]
end
if schema
record=pbGetCsvRecord(matchData[2],lineno,schema)
types[currentmap][schema[0]]=record
end
end
}
types.compact!
maxValue=0
for type in types; maxValue=[maxValue,type[0]].max; end
pseudotypes=[]
specialtypes=[]
typenames=[]
typeinames=[]
typehash={}
for type in types
pseudotypes.push(type[0]) if type[3]
typenames[type[0]]=type[1]
typeinames[type[0]]=type[2]
typehash[type[0]]=type
end
for type in types
n=type[1]
for w in type[5]; if !typeinames.include?(w)
raise _INTL("'{1}' no es un tipo definido (PBS/types.txt, {2}, Weaknesses/Debilidades)",w,n)
end; end
for w in type[6]; if !typeinames.include?(w)
raise _INTL("'{1}' no es un tipo definido (PBS/types.txt, {2}, Resistances/Resistencias)",w,n)
end; end
for w in type[7]; if !typeinames.include?(w)
raise _INTL("'{1}' no es un tipo definido (PBS/types.txt, {2}, Immunities/Inmunidades)",w,n)
end; end
end
for i in 0..maxValue
pseudotypes.push(i) if !typehash[i]
end
pseudotypes.sort!
for type in types; specialtypes.push(type[0]) if type[4]; end
specialtypes.sort!
MessageTypes.setMessages(MessageTypes::Types,typenames)
code="class PBTypes\r\n"
for type in types
code+="#{type[2]}=#{type[0]}\r\n"
end
code+="def PBTypes.getName(id)\r\nreturn pbGetMessage(MessageTypes::Types,id)\r\nend\r\n"
code+="def PBTypes.getCount; return #{types.length}; end\r\n"
code+="def PBTypes.maxValue; return #{maxValue}; end\r\n"
count=maxValue+1
for i in 0...count
type=typehash[i]
j=0; k=i; while j<count
typechart[k]=2
atype=typehash[j]
if type && atype
typechart[k]=4 if type[5].include?(atype[2]) typechart[k]=1 if type[6].include?(atype[2]) typechart[k]=0 if type[7].include?(atype[2]) end
j+=1
k+=count
end
end
code+="end\r\n"
eval(code)
save_data([pseudotypes,specialtypes,typechart],"Data/types.dat")
pbAddScript(code,"PBTypes")
Graphics.update
end
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'scripts/Sprite_Resizer.rb', line 72
def pbConfigureFullScreen
params = Win32API.fillScreen
fullgamew = gamew = DEFAULTSCREENWIDTH
fullgameh = gameh = DEFAULTSCREENHEIGHT
if !FULLSCREENBORDERCROP && $PokemonSystem && $PokemonSystem.border==1
fullgamew += BORDERWIDTH * 2
fullgameh += BORDERHEIGHT * 2
end
factor_x = ((2*params[0])/fullgamew).floor
factor_y = ((2*params[1])/fullgameh).floor
factor = [factor_x,factor_y].min/2.0
offset_x = (params[0]-gamew*factor)/(2*factor)
offset_y = (params[1]-gameh*factor)/(2*factor)
$ResizeOffsetX = offset_x
$ResizeOffsetY = offset_y
ObjectSpace.each_object(Viewport){|o|
begin
next if o.rect.nil?
ox = o.rect.x-$ResizeOffsetX
oy = o.rect.y-$ResizeOffsetY
o.rect.x = ox+offset_x
o.rect.y = oy+offset_y
rescue RGSSError
end
}
pbSetResizeFactor2(factor,true)
end
|
#pbConsumeItemInBattle(bag, item) ⇒ Object
574
575
576
577
578
579
580
581
|
# File 'scripts/PItem_Items.rb', line 574
def pbConsumeItemInBattle(bag,item)
if item!=0 && $ItemData[item][ITEMBATTLEUSE]!=3 &&
$ItemData[item][ITEMBATTLEUSE]!=4 &&
$ItemData[item][ITEMBATTLEUSE]!=0
$PokemonBag.pbDeleteItem(item)
end
end
|
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
|
# File 'scripts/BattleAnimationEditor.rb', line 3868
def pbConvertAnimsToNewFormat
Kernel.pbMessage(_INTL("Will convert animations now."))
count=0
animations=tryLoadData("Data/PkmnAnimations.rxdata")
if !animations || !animations[0]
Kernel.pbMessage(_INTL("No animations exist."))
return
end
for k in 0...animations.length
next if !animations[k]
ret=pbConvertAnimToNewFormat(animations[k])
count+=1 if ret
end
save_data(animations,"Data/PkmnAnimations.rxdata") if count>0
Kernel.pbMessage(_INTL("{1} animations converted to new format.",count))
end
|
#pbConvertRPGAnimation(animation) ⇒ Object
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 415
def pbConvertRPGAnimation(animation)
pbanim=PBAnimation.new
pbanim.id=animation.id
pbanim.name=animation.name.clone
pbanim.graphic=animation.animation_name
pbanim.hue=animation.animation_hue
pbanim.array.clear
yoffset=0
pbanim.position=animation.position
yoffset=-64 if animation.position==0
yoffset=64 if animation.position==2
for i in 0...animation.frames.length
frame=pbanim.addFrame
animframe=animation.frames[i]
for j in 0...animframe.cell_max
data=animframe.cell_data
if data[j,0]!=-1
if animation.position==3 point=transformPoint(
-160,80,160,-80,
PokeBattle_SceneConstants::FOCUSUSER_X,PokeBattle_SceneConstants::FOCUSUSER_Y,
PokeBattle_SceneConstants::FOCUSTARGET_X,PokeBattle_SceneConstants::FOCUSTARGET_Y,
data[j,1],data[j,2]
)
cel=pbCreateCel(point[0],point[1],data[j,0])
else
cel=pbCreateCel(data[j,1],data[j,2]+yoffset,data[j,0])
end
cel[AnimFrame::ZOOMX]=data[j,3]
cel[AnimFrame::ZOOMY]=data[j,3]
cel[AnimFrame::ANGLE]=data[j,4]
cel[AnimFrame::MIRROR]=data[j,5]
cel[AnimFrame::OPACITY]=data[j,6]
cel[AnimFrame::BLENDTYPE]=0
frame.push(cel)
else
frame.push(nil)
end
end
end
for i in 0...animation.timings.length
timing=animation.timings[i]
newtiming=PBAnimTiming.new
newtiming.frame=timing.frame
newtiming.name=timing.se.name
newtiming.volume=timing.se.volume
newtiming.pitch=timing.se.pitch
newtiming.flashScope=timing.flash_scope
newtiming.flashColor=timing.flash_color.clone
newtiming.flashDuration=timing.flash_duration
pbanim.timing.push(newtiming)
end
return pbanim
end
|
#pbConvertToItemEvent(event) ⇒ Object
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
|
# File 'scripts/Compiler.rb', line 3729
def pbConvertToItemEvent(event)
return nil if !event || event.pages.length==0
ret=RPG::Event.new(event.x,event.y)
name=event.name
ret.name=event.name
ret.id=event.id
ret.pages=[]
itemid=nil
itemname=""
hidden=false
if name[/^HiddenItem\:\s*(\w+)\s*$/]
itemname=$1
return nil if !hasConst?(PBItems,itemname)
itemid=PBItems.const_get(itemname)
ret.name="HiddenItem"
hidden=true
elsif name[/^Item\:\s*(\w+)\s*$/]
itemname=$1
return nil if !hasConst?(PBItems,itemname)
itemid=PBItems.const_get(itemname)
ret.name="Item"
else
return nil
end
page=RPG::Event::Page.new
if !hidden
page.graphic.character_name="Object ball"
end
page.list=[]
pbPushBranch(page.list,
sprintf("Kernel.pbItemBall(:%s)",itemname))
pbPushSelfSwitch(page.list,"A",true,1)
pbPushElse(page.list,1)
pbPushBranchEnd(page.list,1)
pbPushEnd(page.list)
ret.pages.push(page)
page=RPG::Event::Page.new
page.condition.self_switch_valid=true
page.condition.self_switch_ch="A"
ret.pages.push(page)
return ret
end
|
#pbConvertToTrainerEvent(event, trainerChecker) ⇒ Object
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
|
# File 'scripts/Compiler.rb', line 3774
def pbConvertToTrainerEvent(event,trainerChecker)
return nil if !event || event.pages.length==0
ret=RPG::Event.new(event.x,event.y)
ret.name=event.name
ret.id=event.id
commands=[]
list=event.pages[0].list
return nil if list.length<2
isFirstCommand=false
i=0; while i<list.length
if list[i].code==108
command=list[i].parameters[0]
j=i+1; while j<list.length
break if list[j].code!=408
command+="\r\n"+list[j].parameters[0]
j+=1
end
if command[/^(Battle\:|Type\:|Name\:|EndSpeech\:|VanishIfSwitch\:|EndBattle\:|RegSpeech\:|BattleID\:|EndIfSwitch\:|DoubleBattle\:|Backdrop\:|Continue\:|Outcome\:)/i]
commands.push(command)
isFirstCommand=true if i==0
end
end
i+=1
end
return nil if commands.length==0
if isFirstCommand && !event.name[/Trainer/]
ret.name="Trainer(3)"
elsif isFirstCommand && event.name[/^\s*Trainer\s+\((\d+)\)\s*$/]
ret.name="Trainer(#{$1})"
end
firstpage=Marshal::load(Marshal.dump(event.pages[0]))
firstpage.trigger=2
firstpage.list=[]
trtype=nil
trname=nil
battles=[]
endbattles=[]
realcommands=[]
endspeeches=[]
regspeech=nil
backdrop=nil
battleid=0
endifswitch=[]
vanishifswitch=[]
doublebattle=false
continue=false
outcome=0
for command in commands
if command[/^Battle\:\s*([\s\S]+)$/i]
battles.push($~[1])
(firstpage.list,command)
end
if command[/^Type\:\s*([\s\S]+)$/i]
trtype=$~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")
(firstpage.list,command)
end
if command[/^Name\:\s*([\s\S]+)$/i]
trname=$~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")
(firstpage.list,command)
end
if command[/^EndSpeech\:\s*([\s\S]+)$/i]
endspeeches.push($~[1].gsub(/^\s+/,"").gsub(/\s+$/,""))
(firstpage.list,command)
end
if command[/^EndIfSwitch\:\s*([\s\S]+)$/i]
endifswitch.push(($~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")).to_i)
(firstpage.list,command)
end
if command[/^DoubleBattle\:\s*([\s\S]+)$/i]
value=$~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")
doublebattle=true if value.upcase=="TRUE" || value.upcase=="YES"
(firstpage.list,command)
end
if command[/^VanishIfSwitch\:\s*([\s\S]+)$/i]
vanishifswitch.push(($~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")).to_i)
(firstpage.list,command)
end
if command[/^Backdrop\:\s*([\s\S]+)$/i]
backdrop=$~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")
(firstpage.list,command)
end
if command[/^RegSpeech\:\s*([\s\S]+)$/i]
regspeech=$~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")
(firstpage.list,command)
end
if command[/^EndBattle\:\s*([\s\S]+)$/i]
endbattles.push($~[1].gsub(/^\s+/,"").gsub(/\s+$/,""))
(firstpage.list,command)
end
if command[/^BattleID\:\s*(\d+)$/i]
battleid=$~[1].to_i
(firstpage.list,command)
end
if command[/^Continue\:\s*([\s\S]+)$/i]
value=$~[1].gsub(/^\s+/,"").gsub(/\s+$/,"")
continue=true if value.upcase=="TRUE" || value.upcase=="YES"
(firstpage.list,command)
end
if command[/^Outcome\:\s*(\d+)$/i]
outcome=$~[1].to_i
(firstpage.list,command)
end
end
if battles.length<=0
return nil
end
if firstpage.graphic.character_name=="" && hasConst?(PBTrainers,trtype)
trainerid=getConst(PBTrainers,trtype)
if trainerid
filename=pbTrainerCharNameFile(trainerid)
if FileTest.image_exist?("Graphics/Characters/"+filename)
firstpage.graphic.character_name=sprintf(filename)
end
end
end
safetrcombo=sprintf("PBTrainers:"+":%s,\"%s\"",trtype,safequote(trname))
safetrcombo2=sprintf(":%s,\"%s\"",trtype,safequote(trname))
introplay=sprintf("pbTrainerIntro(:%s)",trtype)
pbPushScript(firstpage.list,introplay)
pbPushScript(firstpage.list,"Kernel.pbNoticePlayer(get_character(0))")
pbPushText(firstpage.list,battles[0])
if battles.length>1
pbPushScript(firstpage.list,sprintf("Kernel.pbTrainerCheck(%s,%d,%d)",safetrcombo2,battles.length,battleid))
end
if backdrop
pbPushScript(firstpage.list,sprintf("$PokemonGlobal.nextBattleBack=\"%s\"",safequote(backdrop)))
end
espeech=(endspeeches[0]) ? endspeeches[0] : "..."
trainerChecker.pbTrainerBattleCheck(trtype,trname,battleid) if !$INEDITOR
pbPushBranch(firstpage.list,
sprintf("pbTrainerBattle(%s,_I(\"%s\"),%s,%d,%s,%d)",
safetrcombo,safequote2(espeech),
doublebattle ? "true" : "false",
battleid,
continue ? "true" : "false",
outcome)
)
if battles.length>1
pbPushScript(firstpage.list,sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_character(0),%s,%d)",regspeech,safetrcombo,battles.length),1)
end
pbPushSelfSwitch(firstpage.list,"A",true,1)
pbPushBranchEnd(firstpage.list,1)
pbPushScript(firstpage.list,"pbTrainerEnd",0)
pbPushEnd(firstpage.list)
secondpage=Marshal::load(Marshal.dump(firstpage))
secondpage.list=[]
secondpage.trigger=0
secondpage.condition=firstpage.condition.clone
thirdpage=Marshal::load(Marshal.dump(secondpage))
thirdpage.list=secondpage.list.clone
thirdpage.condition=secondpage.condition.clone
secondpage.condition.self_switch_valid=true
secondpage.condition.self_switch_ch="A"
thirdpage.condition.self_switch_valid=true
thirdpage.condition.self_switch_ch="B"
for i in 1...battles.length
if endspeeches.length==0
espeech="..."
else
espeech=(endspeeches[i]) ? endspeeches[i] : endspeeches[endspeeches.length-1]
end
if endbattles.length==0
ebattle=nil
else
ebattle=(endbattles[i]) ? endbattles[i] : endbattles[endbattles.length-1]
end
if i==battles.length-1
pbPushBranch(thirdpage.list,sprintf("pbPhoneBattleCount(%s)>=%d",safetrcombo,i))
pbPushBranch(secondpage.list,sprintf("pbPhoneBattleCount(%s)>%d",safetrcombo,i))
else
pbPushBranch(thirdpage.list,sprintf("pbPhoneBattleCount(%s)==%d",safetrcombo,i))
pbPushBranch(secondpage.list,sprintf("pbPhoneBattleCount(%s)==%d",safetrcombo,i))
end
pbPushText(secondpage.list,ebattle,1)
pbPushScript(secondpage.list,sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_character(0),%s,%d)",regspeech,safetrcombo,battles.length),1)
pbPushExit(secondpage.list,1)
pbPushBranchEnd(secondpage.list,1)
pbPushScript(thirdpage.list,introplay,1)
pbPushText(thirdpage.list,battles[i],1)
trainerChecker.pbTrainerBattleCheck(trtype,trname,battleid+i) if !$INEDITOR
if backdrop
pbPushScript(thirdpage.list,sprintf("$PokemonGlobal.nextBattleBack=\"%s\"",safequote(backdrop)),1)
end
pbPushBranch(thirdpage.list,
sprintf("pbTrainerBattle(%s,_I(\"%s\"),%s,%d,%s,%d)",
safetrcombo,safequote2(espeech),
doublebattle ? "true" : "false",
battleid+i,
continue ? "true" : "false",
outcome),1
)
pbPushScript(thirdpage.list,
sprintf("pbPhoneIncrement(%s,%d)",safetrcombo,battles.length),2)
pbPushSelfSwitch(thirdpage.list,"A",true,2)
pbPushSelfSwitch(thirdpage.list,"B",false,2)
pbPushScript(thirdpage.list,"pbTrainerEnd",2)
pbPushBranchEnd(thirdpage.list,2)
pbPushExit(thirdpage.list,1)
pbPushBranchEnd(thirdpage.list,1)
end
ebattle=(endbattles[0]) ? endbattles[0] : "..."
pbPushText(secondpage.list,ebattle)
if battles.length>1
pbPushScript(secondpage.list,sprintf("pbPhoneRegisterBattle(_I(\"%s\"),get_character(0),%s,%d)",regspeech,safetrcombo,battles.length))
end
pbPushEnd(secondpage.list)
pbPushEnd(thirdpage.list)
if battles.length==1
ret.pages=[firstpage,secondpage]
else
ret.pages=[firstpage,thirdpage,secondpage]
end
for endswitch in endifswitch
ebattle=(endbattles[0]) ? endbattles[0] : "..."
endIfSwitchPage=Marshal::load(Marshal.dump(secondpage))
endIfSwitchPage.condition=secondpage.condition.clone
if endIfSwitchPage.condition.switch1_valid
endIfSwitchPage.condition.switch2_valid=true
endIfSwitchPage.condition.switch2_id=endswitch
else
endIfSwitchPage.condition.switch1_valid=true
endIfSwitchPage.condition.switch1_id=endswitch
end
endIfSwitchPage.condition.self_switch_valid=false
endIfSwitchPage.list=[]
pbPushText(endIfSwitchPage.list,ebattle)
pbPushEnd(endIfSwitchPage.list)
ret.pages.push(endIfSwitchPage)
end
for endswitch in vanishifswitch
ebattle=(endbattles[0]) ? endbattles[0] : "..."
endIfSwitchPage=Marshal::load(Marshal.dump(secondpage))
endIfSwitchPage.graphic.character_name="" endIfSwitchPage.condition=secondpage.condition.clone
if endIfSwitchPage.condition.switch1_valid
endIfSwitchPage.condition.switch2_valid=true
endIfSwitchPage.condition.switch2_id=endswitch
else
endIfSwitchPage.condition.switch1_valid=true
endIfSwitchPage.condition.switch1_id=endswitch
end
endIfSwitchPage.condition.self_switch_valid=false
endIfSwitchPage.list=[]
pbPushEnd(endIfSwitchPage.list)
ret.pages.push(endIfSwitchPage)
end
return ret
end
|
#pbConvertTrainerData ⇒ Object
#pbCopyBitmap(dstbm, srcbm, x, y, opacity = 255) ⇒ Object
984
985
986
987
|
# File 'scripts/SpriteWindow.rb', line 984
def pbCopyBitmap(dstbm,srcbm,x,y,opacity=255)
rc=Rect.new(0,0,srcbm.width,srcbm.height)
dstbm.blt(x,y,srcbm,rc,opacity)
end
|
#pbCopyFrames(canvas) ⇒ Object
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
|
# File 'scripts/BattleAnimationEditor.rb', line 2449
def pbCopyFrames(canvas)
sliderwin2=ControlWindow.new(0,0,320,32*6)
sliderwin2.viewport=canvas.viewport
sliderwin2.addSlider(_INTL("First Frame:"),1,canvas.animation.length,1)
sliderwin2.addSlider(_INTL("Last Frame:"),1,canvas.animation.length,canvas.animation.length)
sliderwin2.addSlider(_INTL("Copy to:"),1,canvas.animation.length,canvas.currentframe+1)
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
sliderwin2.opacity=200
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
startvalue=sliderwin2.value(0)-1
endvalue=sliderwin2.value(1)-1
dstvalue=sliderwin2.value(2)-1
length=(endvalue-startvalue)+1
if length>0 if (startvalue<dstvalue)
startvalue+=length
dstvalue+=length
while length!=0
canvas.copyFrame(startvalue-1,dstvalue-1)
startvalue-=1
dstvalue-=1
length-=1
end
elsif startvalue!=dstvalue
while length!=0
canvas.copyFrame(startvalue,dstvalue)
startvalue+=1
dstvalue+=1
length-=1
end
end
end
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
return
end
|
#pbCreateCel(x, y, pattern, focus = 4) ⇒ Object
#pbCreateMysteryGift(type, item) ⇒ Object
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'scripts/PScreen_MysteryGift.rb', line 113
def pbCreateMysteryGift(type,item)
gift=pbEditMysteryGift(type,item)
if !gift
Kernel.pbMessage(_INTL("No se creó el regalo."))
else
begin
if safeExists?("MysteryGiftMaster.txt")
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
master.push(gift)
else
master=[gift]
end
string=pbMysteryGiftEncrypt(master)
File.open("MysteryGiftMaster.txt","wb"){|f|
f.write(string)
}
Kernel.pbMessage(_INTL("El regalo ha sido guardado en MysteryGiftMaster.txt."))
rescue
Kernel.pbMessage(_INTL("No se pudo guardar el regalo en MysteryGiftMaster.txt."))
end
end
end
|
#pbCriticalCode ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'scripts/Compiler.rb', line 64
def pbCriticalCode
ret=0
begin
yield
ret=1
rescue Exception
e=$!
if e.is_a?(Reset) || e.is_a?(SystemExit)
raise
else
pbPrintException(e)
if e.is_a?(Hangup)
ret=2
raise Reset.new
end
end
end
return ret
end
|
#pbCsvField!(str) ⇒ Object
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
# File 'scripts/Messages.rb', line 155
def pbCsvField!(str)
ret=""
str.sub!(/\A\s*/,"")
if str[0,1]=="\""
str[0,1]=""
escaped=false
fieldbytes=0
str.scan(/./) do |s|
fieldbytes+=s.length
break if s=="\"" && !escaped
if s=="\\" && !escaped
escaped=true
else
ret+=s
escaped=false
end
end
str[0,fieldbytes]=""
if !str[/\A\s*,/] && !str[/\A\s*$/]
raise _INTL("Campo entrecomillado invalido (en: {1})",ret)
end
str[0,str.length]=$~.post_match
else
if str[/,/]
str[0,str.length]=$~.post_match
ret=$~.pre_match
else
ret=str.clone
str[0,str.length]=""
end
ret.gsub!(/\s+$/,"")
end
return ret
end
|
#pbCsvPosInt!(str) ⇒ Object
190
191
192
193
194
195
196
|
# File 'scripts/Messages.rb', line 190
def pbCsvPosInt!(str)
ret=pbCsvField!(str)
if !ret[/\A\d+$/]
raise _INTL("Campo {1} no es un entero positivo",ret)
end
return ret.to_i
end
|
#pbCueBGM(bgm, seconds, volume = nil, pitch = nil) ⇒ Object
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
|
# File 'scripts/PField_Field.rb', line 1981
def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)
return if !bgm
bgm=pbResolveAudioFile(bgm,volume,pitch)
playingBGM=$game_system.playing_bgm
if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch
pbBGMFade(seconds)
if !$PokemonTemp.cueFrames
$PokemonTemp.cueFrames=(seconds*Graphics.frame_rate)*3/5
end
$PokemonTemp.cueBGM=bgm
elsif playingBGM
pbBGMPlay(bgm)
end
end
|
220
221
222
223
224
225
|
# File 'scripts/Messages.rb', line 220
def (elements,trigger)
return nil if !pbMapInterpreterRunning?
event=pbMapInterpreter.get_character(0)
return nil if !event
return (event,elements,trigger)
end
|
#pbDayCareChoose(text, variable) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'scripts/PField_DayCare.rb', line 127
def pbDayCareChoose(text,variable)
count=pbDayCareDeposited
if count==0
raise _INTL("Aquí no hay ningún Pokémon...")
elsif count==1
$game_variables[variable]=$PokemonGlobal.daycare[0][0] ? 0 : 1
else
choices=[]
for i in 0...2
pokemon=$PokemonGlobal.daycare[i][0]
if pokemon.isMale?
choices.push(_ISPRINTF("{1:s} (♂, Nv{2:d})",pokemon.name,pokemon.level))
elsif pokemon.isFemale?
choices.push(_ISPRINTF("{1:s} (♀, Nv{2:d})",pokemon.name,pokemon.level))
else
choices.push(_ISPRINTF("{1:s} (Nv{2:d})",pokemon.name,pokemon.level))
end
end
choices.push(_INTL("Cancelar"))
command=Kernel.pbMessage(text,choices,choices.length)
$game_variables[variable]=(command==2) ? -1 : command
end
end
|
#pbDayCareCompatibleGender(pokemon1, pokemon2) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
|
# File 'scripts/PField_DayCare.rb', line 62
def pbDayCareCompatibleGender(pokemon1,pokemon2)
if (pokemon1.isFemale? && pokemon2.isMale?) ||
(pokemon1.isMale? && pokemon2.isFemale?)
return true
end
ditto1=pbIsDitto?(pokemon1)
ditto2=pbIsDitto?(pokemon2)
return true if ditto1 && !ditto2
return true if ditto2 && !ditto1
return false
end
|
#pbDayCareDeposit(index) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'scripts/PField_DayCare.rb', line 14
def pbDayCareDeposit(index)
for i in 0...2
if !$PokemonGlobal.daycare[i][0]
$PokemonGlobal.daycare[i][0]=$Trainer.party[index]
$PokemonGlobal.daycare[i][1]=$Trainer.party[index].level
$PokemonGlobal.daycare[i][0].heal
$Trainer.party[index]=nil
$Trainer.party.compact!
$PokemonGlobal.daycareEgg=0
$PokemonGlobal.daycareEggSteps=0
return
end
end
raise _INTL("No hay espacio para depositar un Pokémon")
end
|
#pbDayCareDeposited ⇒ Object
6
7
8
9
10
11
12
|
# File 'scripts/PField_DayCare.rb', line 6
def pbDayCareDeposited
ret=0
for i in 0...2
ret+=1 if $PokemonGlobal.daycare[i][0]
end
return ret
end
|
#pbDayCareGenerateEgg ⇒ Object
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
# File 'scripts/PField_DayCare.rb', line 151
def pbDayCareGenerateEgg
if pbDayCareDeposited!=2
return
elsif $Trainer.party.length>=6
raise _INTL("No se puede guardar el huevo")
end
pokemon0=$PokemonGlobal.daycare[0][0]
pokemon1=$PokemonGlobal.daycare[1][0]
mother=nil
father=nil
babyspecies=0
ditto0=pbIsDitto?(pokemon0)
ditto1=pbIsDitto?(pokemon1)
if (pokemon0.isFemale? || ditto0)
babyspecies=(ditto0) ? pokemon1.species : pokemon0.species
mother=pokemon0
father=pokemon1
else
babyspecies=(ditto1) ? pokemon0.species : pokemon1.species
mother=pokemon1
father=pokemon0
end
babyspecies=pbGetBabySpecies(babyspecies,mother.item,father.item)
if isConst?(babyspecies,PBSpecies,:MANAPHY) && hasConst?(PBSpecies,:PHIONE)
babyspecies=getConst(PBSpecies,:PHIONE)
elsif (isConst?(babyspecies,PBSpecies,:NIDORANfE) && hasConst?(PBSpecies,:NIDORANmA)) ||
(isConst?(babyspecies,PBSpecies,:NIDORANmA) && hasConst?(PBSpecies,:NIDORANfE))
babyspecies=[getConst(PBSpecies,:NIDORANmA),
getConst(PBSpecies,:NIDORANfE)][rand(2)]
elsif (isConst?(babyspecies,PBSpecies,:VOLBEAT) && hasConst?(PBSpecies,:ILLUMISE)) ||
(isConst?(babyspecies,PBSpecies,:ILLUMISE) && hasConst?(PBSpecies,:VOLBEAT))
babyspecies=[getConst(PBSpecies,:VOLBEAT),
getConst(PBSpecies,:ILLUMISE)][rand(2)]
end
egg=PokeBattle_Pokemon.new(babyspecies,EGGINITIALLEVEL,$Trainer)
pid=rand(65536)
pid|=(rand(65536)<<16)
egg.personalID=pid
if isConst?(babyspecies,PBSpecies,:BURMY) ||
isConst?(babyspecies,PBSpecies,:SHELLOS) ||
isConst?(babyspecies,PBSpecies,:BASCULIN) ||
isConst?(babyspecies,PBSpecies,:FLABEBE) ||
isConst?(babyspecies,PBSpecies,:PUMPKABOO) ||
isConst?(babyspecies,PBSpecies,:MINIOR)
egg.form=mother.form
end
moves=[]
othermoves=[]
movefather=father; movemother=mother
if pbIsDitto?(movefather) && !mother.isFemale?
movefather=mother; movemother=father
end
initialmoves=egg.getMoveList
for k in initialmoves
if k[0]<=EGGINITIALLEVEL
moves.push(k[1])
else
othermoves.push(k[1]) if mother.hasMove?(k[1]) && father.hasMove?(k[1])
end
end
for move in othermoves
moves.push(move)
end
if !USENEWBATTLEMECHANICS
for i in 0...$ItemData.length
next if !$ItemData[i]
atk=$ItemData[i][ITEMMACHINE]
next if !atk || atk==0
if egg.isCompatibleWithMove?(atk)
moves.push(atk) if movefather.hasMove?(atk)
end
end
end
if movefather.isMale?
pbRgssOpen("Data/eggEmerald.dat","rb"){|f|
f.pos=(babyspecies-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
atk=f.fgetw
moves.push(atk) if movefather.hasMove?(atk)
i+=1
end
end
}
end
if USENEWBATTLEMECHANICS
pbRgssOpen("Data/eggEmerald.dat","rb"){|f|
f.pos=(babyspecies-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
atk=f.fgetw
moves.push(atk) if movemother.hasMove?(atk)
i+=1
end
end
}
end
lightball=false
if (isConst?(father.species,PBSpecies,:PIKACHU) ||
isConst?(father.species,PBSpecies,:RAICHU)) &&
isConst?(father.item,PBItems,:LIGHTBALL)
lightball=true
end
if (isConst?(mother.species,PBSpecies,:PIKACHU) ||
isConst?(mother.species,PBSpecies,:RAICHU)) &&
isConst?(mother.item,PBItems,:LIGHTBALL)
lightball=true
end
if lightball && isConst?(babyspecies,PBSpecies,:PICHU) &&
hasConst?(PBMoves,:VOLTTACKLE)
moves.push(getConst(PBMoves,:VOLTTACKLE))
end
moves|=[] finalmoves=[]
listend=moves.length-4
listend=0 if listend<0
j=0
for i in listend..listend+3
moveid=(i>=moves.length) ? 0 : moves[i]
finalmoves[j]=PBMove.new(moveid)
j+=1
end
ivs=[]
for i in 0...6
ivs[i]=rand(32)
end
ivinherit=[]
for i in 0...2
parent=[mother,father][i]
ivinherit[i]=PBStats::HP if isConst?(parent.item,PBItems,:POWERWEIGHT)
ivinherit[i]=PBStats::ATTACK if isConst?(parent.item,PBItems,:POWERBRACER)
ivinherit[i]=PBStats::DEFENSE if isConst?(parent.item,PBItems,:POWERBELT)
ivinherit[i]=PBStats::SPEED if isConst?(parent.item,PBItems,:POWERANKLET)
ivinherit[i]=PBStats::SPATK if isConst?(parent.item,PBItems,:POWERLENS)
ivinherit[i]=PBStats::SPDEF if isConst?(parent.item,PBItems,:POWERBAND)
end
num=0; r=rand(2)
for i in 0...2
if ivinherit[r]!=nil
parent=[mother,father][r]
ivs[ivinherit[r]]=parent.iv[ivinherit[r]]
num+=1
break
end
r=(r+1)%2
end
stats=[PBStats::HP,PBStats::ATTACK,PBStats::DEFENSE,
PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF]
limit=(USENEWBATTLEMECHANICS && (isConst?(mother.item,PBItems,:DESTINYKNOT) ||
isConst?(father.item,PBItems,:DESTINYKNOT))) ? 5 : 3
loop do
freestats=[]
for i in stats
freestats.push(i) if !ivinherit.include?(i)
end
break if freestats.length==0
r=freestats[rand(freestats.length)]
parent=[mother,father][rand(2)]
ivs[r]=parent.iv[r]
ivinherit.push(r)
num+=1
break if num>=limit
end
newnatures=[]
newnatures.push(mother.nature) if isConst?(mother.item,PBItems,:EVERSTONE)
newnatures.push(father.nature) if isConst?(father.item,PBItems,:EVERSTONE)
if newnatures.length>0
egg.setNature(newnatures[rand(newnatures.length)])
end
shinyretries=0
shinyretries+=5 if father.language!=mother.language
shinyretries+=2 if hasConst?(PBItems,:SHINYCHARM) &&
$PokemonBag.pbQuantity(:SHINYCHARM)>0
if shinyretries>0
for i in 0...shinyretries
break if egg.isShiny?
egg.personalID=rand(65536)|(rand(65536)<<16)
end
end
if (!ditto0 && !ditto1)
if mother.hasHiddenAbility?
egg.setAbility(mother.abilityIndex) if rand(10)<6
else
if rand(10)<8
egg.setAbility(mother.abilityIndex)
else
egg.setAbility((mother.abilityIndex+1)%2)
end
end
elsif ((!ditto0 && ditto1) || (!ditto1 && ditto0)) && USENEWBATTLEMECHANICS
parent=(!ditto0) ? mother : father
if parent.hasHiddenAbility?
egg.setAbility(parent.abilityIndex) if rand(10)<6
end
end
if mother.isFemale? &&
!isConst?(pbBallTypeToBall(mother.ballused),PBItems,:MASTERBALL) &&
!isConst?(pbBallTypeToBall(mother.ballused),PBItems,:CHERISHBALL)
egg.ballused=mother.ballused
end
egg.iv[0]=ivs[0]
egg.iv[1]=ivs[1]
egg.iv[2]=ivs[2]
egg.iv[3]=ivs[3]
egg.iv[4]=ivs[4]
egg.iv[5]=ivs[5]
egg.moves[0]=finalmoves[0]
egg.moves[1]=finalmoves[1]
egg.moves[2]=finalmoves[2]
egg.moves[3]=finalmoves[3]
egg.calcStats
egg.obtainText=_INTL("Pareja de la Guardería")
egg.name=_INTL("Huevo")
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,babyspecies,21)
eggsteps=dexdata.fgetw
dexdata.close
egg.eggsteps=eggsteps
if rand(65536)<POKERUSCHANCE
egg.givePokerus
end
$Trainer.party[$Trainer.party.length]=egg
end
|
#pbDayCareGetCompat ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'scripts/PField_DayCare.rb', line 74
def pbDayCareGetCompat
if pbDayCareDeposited==2
pokemon1=$PokemonGlobal.daycare[0][0]
pokemon2=$PokemonGlobal.daycare[1][0]
return 0 if (pokemon1.isShadow? rescue false)
return 0 if (pokemon2.isShadow? rescue false)
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,pokemon1.species,31)
compat10=dexdata.fgetb
compat11=dexdata.fgetb
pbDexDataOffset(dexdata,pokemon2.species,31)
compat20=dexdata.fgetb
compat21=dexdata.fgetb
dexdata.close
if !isConst?(compat10,PBEggGroups,:Undiscovered) &&
!isConst?(compat11,PBEggGroups,:Undiscovered) &&
!isConst?(compat20,PBEggGroups,:Undiscovered) &&
!isConst?(compat21,PBEggGroups,:Undiscovered)
if compat10==compat20 || compat11==compat20 ||
compat10==compat21 || compat11==compat21 ||
isConst?(compat10,PBEggGroups,:Ditto) ||
isConst?(compat11,PBEggGroups,:Ditto) ||
isConst?(compat20,PBEggGroups,:Ditto) ||
isConst?(compat21,PBEggGroups,:Ditto)
if pbDayCareCompatibleGender(pokemon1,pokemon2)
ret=1
ret+=1 if pokemon1.species==pokemon2.species
ret+=1 if pokemon1.trainerID!=pokemon2.trainerID
return ret
end
end
end
end
return 0
end
|
#pbDayCareGetCompatibility(variable) ⇒ Object
110
111
112
|
# File 'scripts/PField_DayCare.rb', line 110
def pbDayCareGetCompatibility(variable)
$game_variables[variable]=pbDayCareGetCompat
end
|
#pbDayCareGetDeposited(index, nameVariable, costVariable) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'scripts/PField_DayCare.rb', line 38
def pbDayCareGetDeposited(index,nameVariable,costVariable)
for i in 0...2
if (index<0||i==index) && $PokemonGlobal.daycare[i][0]
cost=$PokemonGlobal.daycare[i][0].level-$PokemonGlobal.daycare[i][1]
cost+=1
cost*=100
$game_variables[costVariable]=cost if costVariable>=0
$game_variables[nameVariable]=$PokemonGlobal.daycare[i][0].name if nameVariable>=0
return
end
end
raise _INTL("No se pudo encontrar el Pokémon depositado")
end
|
#pbDayCareGetLevelGain(index, nameVariable, levelVariable) ⇒ Object
30
31
32
33
34
35
36
|
# File 'scripts/PField_DayCare.rb', line 30
def pbDayCareGetLevelGain(index,nameVariable,levelVariable)
pkmn=$PokemonGlobal.daycare[index][0]
return false if !pkmn
$game_variables[nameVariable]=pkmn.name
$game_variables[levelVariable]=pkmn.level-$PokemonGlobal.daycare[index][1]
return true
end
|
#pbDayCareWithdraw(index) ⇒ Object
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'scripts/PField_DayCare.rb', line 114
def pbDayCareWithdraw(index)
if !$PokemonGlobal.daycare[index][0]
raise _INTL("Aquí no hay ningún Pokémon...")
elsif $Trainer.party.length>=6
raise _INTL("No se puede guardar el Pokémon...")
else
$Trainer.party[$Trainer.party.length]=$PokemonGlobal.daycare[index][0]
$PokemonGlobal.daycare[index][0]=nil
$PokemonGlobal.daycare[index][1]=0
$PokemonGlobal.daycareEgg=0
end
end
|
#pbDayNightTint(object) ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'scripts/PField_Time.rb', line 124
def pbDayNightTint(object)
if !$scene.is_a?(Scene_Map)
return
else
if ENABLESHADING && $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
tone=PBDayNight.getTone()
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
else
object.tone.set(0,0,0,0)
end
end
end
|
#pbDeactivateWindows(sprites) ⇒ Object
Deactivates all windows. If a code block is given, deactivates all windows, runs the code in the block, and reactivates them.
1308
1309
1310
1311
1312
1313
1314
|
# File 'scripts/SpriteWindow.rb', line 1308
def pbDeactivateWindows(sprites)
if block_given?
pbActivateWindow(sprites,nil) { yield }
else
pbActivateWindow(sprites,nil)
end
end
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
|
# File 'scripts/Debug.rb', line 233
def
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
sprites={}
commands=CommandList.new
commands.add("switches",_INTL("Interruptores"))
commands.add("variables",_INTL("Variables"))
commands.add("refreshmap",_INTL("Refrescar Mapa"))
commands.add("warp",_INTL("Saltar a Mapa"))
commands.add("healparty",_INTL("Curar Equipo"))
commands.add("additem",_INTL("Agregar Objeto"))
commands.add("fillbag",_INTL("Llenar Mochila"))
commands.add("clearbag",_INTL("Vaciar Mochila"))
commands.add("addpokemon",_INTL("Agregar Pokémon"))
commands.add("fillboxes",_INTL("Llenar Cajas de Almacenamiento"))
commands.add("clearboxes",_INTL("Vaciar Cajas de Almacenamiento"))
commands.add("usepc",_INTL("Usar PC"))
commands.add("setplayer",_INTL("Setear Personaje del Jugador"))
commands.add("renameplayer",_INTL("Renombrar Jugador"))
commands.add("randomid",_INTL("Cambiar ID del Jugador"))
commands.add("changeoutfit",_INTL("Cambiar Ropa del Jugador"))
commands.add("setmoney",_INTL("Setear Dinero"))
commands.add("setcoins",_INTL("Setear Fichas"))
commands.add("setbadges",_INTL("Setear Medallas"))
commands.add("demoparty",_INTL("Obtener Equipo de Prueba"))
commands.add("toggleshoes",_INTL("Habilitar Deportivas"))
commands.add("togglepokegear",_INTL("Habilitar Pokégear"))
commands.add("togglepokedex",_INTL("Habilitar Pokédex"))
commands.add("dexlists",_INTL("Acceso a los Dex"))
commands.add("readyrematches",_INTL("Activar Revanchas del Celular"))
commands.add("mysterygift",_INTL("Gestionar Regalos Misteriosos"))
commands.add("daycare",_INTL("Opciones de la Guardería"))
commands.add("quickhatch",_INTL("Eclosión rápida"))
commands.add("roamerstatus",_INTL("Estado de los Pokémon errantes"))
commands.add("roam",_INTL("Avanzar errantes"))
commands.add("setencounters",_INTL("Setear Encuentros"))
commands.add("setmetadata",_INTL("Setear Metadatos"))
commands.add("terraintags",_INTL("Setear Etiquetas de Terrenos"))
commands.add("trainertypes",_INTL("Editar Tipos de Entrenadores"))
commands.add("resettrainers",_INTL("Restablecer Entrenadores"))
commands.add("testwildbattle",_INTL("Probar Batalla con Salvaje"))
commands.add("testdoublewildbattle",_INTL("Probar Batalla Doble con Salvajes"))
commands.add("testtrainerbattle",_INTL("Probar Batalla con Entrenador"))
commands.add("testdoubletrainerbattle",_INTL("Probar Batalla Doble con Entrenadores"))
commands.add("relicstone",_INTL("Relic Stone"))
commands.add("purifychamber",_INTL("Cámara de Purificación"))
commands.add("extracttext",_INTL("Extraer Texto"))
commands.add("compiletext",_INTL("Compilar Texto"))
commands.add("compiledata",_INTL("Compilar Datos"))
commands.add("mapconnections",_INTL("Conexiones de Mapas"))
commands.add("animeditor",_INTL("Editor de Animaciones"))
commands.add("debugconsole",_INTL("Consola de Depuración"))
commands.add("togglelogging",_INTL("Activar Registro de Batalla"))
sprites["cmdwindow"]=Window_CommandPokemonEx.new(commands.list)
cmdwindow=sprites["cmdwindow"]
cmdwindow.viewport=viewport
cmdwindow.resizeToFit(cmdwindow.commands)
cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height
cmdwindow.x=0
cmdwindow.y=0
cmdwindow.visible=true
pbFadeInAndShow(sprites)
ret=-1
loop do
loop do
cmdwindow.update
Graphics.update
Input.update
if Input.trigger?(Input::B)
ret=-1
break
end
if Input.trigger?(Input::C)
ret=cmdwindow.index
break
end
end
break if ret==-1
cmd=commands.getCommand(ret)
if cmd=="switches"
pbFadeOutIn(99999) { pbDebugScreen(0) }
elsif cmd=="variables"
pbFadeOutIn(99999) { pbDebugScreen(1) }
elsif cmd=="refreshmap"
$game_map.need_refresh = true
Kernel.pbMessage(_INTL("Se refrescará el mapa."))
elsif cmd=="warp"
map=pbWarpToMap()
if map
pbFadeOutAndHide(sprites)
pbDisposeSpriteHash(sprites)
viewport.dispose
if $scene.is_a?(Scene_Map)
$game_temp.player_new_map_id=map[0]
$game_temp.player_new_x=map[1]
$game_temp.player_new_y=map[2]
$game_temp.player_new_direction=2
$scene.transfer_player
$game_map.refresh
else
Kernel.pbCancelVehicles
$MapFactory.setup(map[0])
$game_player.moveto(map[1],map[2])
$game_player.turn_down
$game_map.update
$game_map.autoplay
$game_map.refresh
end
return
end
elsif cmd=="healparty"
for i in $Trainer.party
i.heal
end
Kernel.pbMessage(_INTL("El equipo Pokémon recuperó la salud."))
elsif cmd=="additem"
item=pbListScreen(_INTL("AGREGAR OBJETO"),ItemLister.new(0))
if item && item>0
params=ChooseNumberParams.new
params.setRange(1,BAGMAXPERSLOT)
params.setInitialValue(1)
params.setCancelValue(0)
qty=Kernel.pbMessageChooseNumber(
_INTL("Selecciona el número del objeto."),params
)
if qty>0
if qty==1
Kernel.pbReceiveItem(item)
else
Kernel.pbMessage(_INTL("El objeto ha sido agregado."))
$PokemonBag.pbStoreItem(item,qty)
end
end
end
elsif cmd=="fillbag"
params=ChooseNumberParams.new
params.setRange(1,BAGMAXPERSLOT)
params.setInitialValue(1)
params.setCancelValue(0)
qty=Kernel.pbMessageChooseNumber(
_INTL("Elige el número de objetos."),params
)
if qty>0
itemconsts=[]
for i in PBItems.constants
itemconsts.push(PBItems.const_get(i))
end
itemconsts.sort!{|a,b| a<=>b}
for i in itemconsts
$PokemonBag.pbStoreItem(i,qty)
end
Kernel.pbMessage(_INTL("Se llenó la Mochila con {1} unidades de cada objeto.",qty))
end
elsif cmd=="clearbag"
$PokemonBag.clear
Kernel.pbMessage(_INTL("Se vació la Mochila."))
elsif cmd=="addpokemon"
species=pbChooseSpeciesOrdered(1)
if species!=0
params=ChooseNumberParams.new
params.setRange(1,PBExperience::MAXLEVEL)
params.setInitialValue(5)
params.setCancelValue(0)
level=Kernel.pbMessageChooseNumber(
_INTL("Indicar el nivel del Pokémon."),params)
if level>0
pbAddPokemon(species,level)
end
end
elsif cmd=="fillboxes"
$Trainer.formseen=[] if !$Trainer.formseen
$Trainer.formlastseen=[] if !$Trainer.formlastseen
added=0; completed=true
for i in 1..PBSpecies.maxValue
if added>=STORAGEBOXES*30
completed=false; break
end
cname=getConstantName(PBSpecies,i) rescue nil
next if !cname
pkmn=PokeBattle_Pokemon.new(i,50,$Trainer)
$PokemonStorage[(i-1)/$PokemonStorage.maxPokemon(0),
(i-1)%$PokemonStorage.maxPokemon(0)]=pkmn
$Trainer.seen[i]=true
$Trainer.owned[i]=true
$Trainer.formlastseen[i]=[] if !$Trainer.formlastseen[i]
$Trainer.formlastseen[i]=[0,0] if $Trainer.formlastseen[i]==[]
$Trainer.formseen[i]=[[],[]] if !$Trainer.formseen[i]
for j in 0..27
$Trainer.formseen[i][0][j]=true
$Trainer.formseen[i][1][j]=true
end
added+=1
end
Kernel.pbMessage(_INTL("Las Cajas fueron llenadas de un Pokémon de cada especie."))
if !completed
Kernel.pbMessage(_INTL("Nota: La capacidad de almacenamiento ({1} cajas de 30) es menor que el número de especies.",STORAGEBOXES))
end
elsif cmd=="clearboxes"
for i in 0...$PokemonStorage.maxBoxes
for j in 0...$PokemonStorage.maxPokemon(i)
$PokemonStorage[i,j]=nil
end
end
Kernel.pbMessage(_INTL("Se vaciaron las Cajas."))
elsif cmd=="usepc"
pbPokeCenterPC
elsif cmd=="setplayer"
limit=0
for i in 0...8
meta=pbGetMetadata(0,MetadataPlayerA+i)
if !meta
limit=i
break
end
end
if limit<=1
Kernel.pbMessage(_INTL("Hay un sólo personaje definido."))
else
params=ChooseNumberParams.new
params.setRange(0,limit-1)
params.setDefaultValue($PokemonGlobal.playerID)
newid=Kernel.pbMessageChooseNumber(
_INTL("Seleccione el nuevo personaje del jugador."),params)
if newid!=$PokemonGlobal.playerID
pbChangePlayer(newid)
Kernel.pbMessage(_INTL("El personaje del jugador ha sido cambiado."))
end
end
elsif cmd=="renameplayer"
trname=pbEnterPlayerName("¿Tu nombre?",0,7,$Trainer.name)
if trname==""
trainertype=pbGetPlayerTrainerType
gender=pbGetTrainerTypeGender(trainertype)
trname=pbSuggestTrainerName(gender)
end
$Trainer.name=trname
Kernel.pbMessage(_INTL("El nombre de jugador cambió a {1}.",$Trainer.name))
elsif cmd=="randomid"
$Trainer.id=rand(256)
$Trainer.id|=rand(256)<<8
$Trainer.id|=rand(256)<<16
$Trainer.id|=rand(256)<<24
Kernel.pbMessage(_INTL("El ID del jugador se cambió por {1} (2).",$Trainer.publicID,$Trainer.id))
elsif cmd=="changeoutfit"
oldoutfit=$Trainer.outfit
params=ChooseNumberParams.new
params.setRange(0,99)
params.setDefaultValue(oldoutfit)
$Trainer.outfit=Kernel.pbMessageChooseNumber(_INTL("Establecer la ropa del jugador."),params)
Kernel.pbMessage(_INTL("La ropa del jugador ha sido cambiada.")) if $Trainer.outfit!=oldoutfit
elsif cmd=="setmoney"
params=ChooseNumberParams.new
params.setMaxDigits(6)
params.setDefaultValue($Trainer.money)
$Trainer.money=Kernel.pbMessageChooseNumber(
_INTL("Indicar la cantidad de dinero del jugador."),params)
Kernel.pbMessage(_INTL("Ahora tiene ${1}.",$Trainer.money))
elsif cmd=="setcoins"
params=ChooseNumberParams.new
params.setRange(0,MAXCOINS)
params.setDefaultValue($PokemonGlobal.coins)
$PokemonGlobal.coins=Kernel.pbMessageChooseNumber(
_INTL("Indicar la cantidad de fichas del jugador."),params)
Kernel.pbMessage(_INTL("Ahora tiene {1} fichas.",$PokemonGlobal.coins))
elsif cmd=="setbadges"
badgecmd=0
loop do
badgecmds=[]
for i in 0...32
badgecmds.push(_INTL("{1} Medalla {2}",$Trainer.badges[i] ? "[Y]" : "[ ]",i+1))
end
badgecmd=Kernel.pbShowCommands(nil,badgecmds,-1,badgecmd)
break if badgecmd<0
$Trainer.badges[badgecmd]=!$Trainer.badges[badgecmd]
end
elsif cmd=="demoparty"
pbCreatePokemon
Kernel.pbMessage(_INTL("Equipo completado con Pokémon de prueba."))
elsif cmd=="toggleshoes"
$PokemonGlobal.runningShoes=!$PokemonGlobal.runningShoes
Kernel.pbMessage(_INTL("Deportivas puestas.")) if $PokemonGlobal.runningShoes
Kernel.pbMessage(_INTL("Deportivas quitadas.")) if !$PokemonGlobal.runningShoes
elsif cmd=="togglepokegear"
$Trainer.pokegear=!$Trainer.pokegear
Kernel.pbMessage(_INTL("Pokégear listo.")) if $Trainer.pokegear
Kernel.pbMessage(_INTL("Pokégear quitado.")) if !$Trainer.pokegear
elsif cmd=="togglepokedex"
$Trainer.pokedex=!$Trainer.pokedex
Kernel.pbMessage(_INTL("Pokédex listo.")) if $Trainer.pokedex
Kernel.pbMessage(_INTL("Pokédex quitado.")) if !$Trainer.pokedex
elsif cmd=="dexlists"
dexescmd=0
loop do
dexescmds=[]
d=pbDexNames
for i in 0...d.length
name=d[i]
name=name[0] if name.is_a?(Array)
dexindex=i
unlocked=$PokemonGlobal.pokedexUnlocked[dexindex]
dexescmds.push(_INTL("{1} {2}",unlocked ? "[Y]" : "[ ]",name))
end
dexescmd=Kernel.pbShowCommands(nil,dexescmds,-1,dexescmd)
break if dexescmd<0
dexindex=dexescmd
if $PokemonGlobal.pokedexUnlocked[dexindex]
pbLockDex(dexindex)
else
pbUnlockDex(dexindex)
end
end
elsif cmd=="readyrematches"
if !$PokemonGlobal.phoneNumbers || $PokemonGlobal.phoneNumbers.length==0
Kernel.pbMessage(_INTL("No hay entrenadores en el Celular."))
else
for i in $PokemonGlobal.phoneNumbers
if i.length==8 i[4]=2
pbSetReadyToBattle(i)
end
end
Kernel.pbMessage(_INTL("Ahora todos los entrenadores registrados en el Celular están listos para una revancha."))
end
elsif cmd=="mysterygift"
pbManageMysteryGifts
elsif cmd=="daycare"
daycarecmd=0
loop do
daycarecmds=[
_INTL("Datos"),
_INTL("Dejar Pokémon"),
_INTL("Sacar Pokémon"),
_INTL("Generar Huevo"),
_INTL("Recibir Huevo"),
_INTL("Entregar Huevo")
]
daycarecmd=Kernel.pbShowCommands(nil,daycarecmds,-1,daycarecmd)
break if daycarecmd<0
case daycarecmd
when 0 if $PokemonGlobal.daycare
num=pbDayCareDeposited
Kernel.pbMessage(_INTL("Hay {1} Pokémon en la guardería.",num))
if num>0
txt=""
for i in 0...num
next if !$PokemonGlobal.daycare[i][0]
pkmn=$PokemonGlobal.daycare[i][0]
initlevel=$PokemonGlobal.daycare[i][1]
gender=[_INTL("♂"),_INTL("♀"),_INTL("genderless")][pkmn.gender]
txt+=_INTL("{1}) {2} ({3}), Nv.{4} (dejado con Nv.{5})",
i,pkmn.name,gender,pkmn.level,initlevel)
txt+="\n" if i<num-1
end
Kernel.pbMessage(txt)
end
if $PokemonGlobal.daycareEgg==1
Kernel.pbMessage(_INTL("Un huevo está esperando ser retirado."))
elsif pbDayCareDeposited==2
if pbDayCareGetCompat==0
Kernel.pbMessage(_INTL("Los Pokémon dejados no se pueden reproducir."))
else
Kernel.pbMessage(_INTL("Los Pokémon dejados se pueden reproducir."))
end
end
end
when 1 if pbEggGenerated?
Kernel.pbMessage(_INTL("Hay un nuevo disponible, no se puede dejar ningún Pokémon."))
elsif pbDayCareDeposited==2
Kernel.pbMessage(_INTL("Ya se dejaron dos Pokémon en la guardería."))
elsif $Trainer.party.length==0
Kernel.pbMessage(_INTL("No hay equipo, no se puede dejar ningún Pokémon."))
else
pbChooseNonEggPokemon(1,3)
if pbGet(1)>=0
pbDayCareDeposit(pbGet(1))
Kernel.pbMessage(_INTL("Se ha dejado a {1}.",pbGet(3)))
end
end
when 2 if pbEggGenerated?
Kernel.pbMessage(_INTL("Hay un huevo disponible, no se puede sacar ningún Pokémon."))
elsif pbDayCareDeposited==0
Kernel.pbMessage(_INTL("No hay ningún Pokémon en la guardería."))
elsif $Trainer.party.length>=6
Kernel.pbMessage(_INTL("El equipo está completo, no se puede sacar ningún Pokémon."))
else
pbDayCareChoose(_INTL("¿Cúal quieres sacar?"),1)
if pbGet(1)>=0
pbDayCareGetDeposited(pbGet(1),3,4)
pbDayCareWithdraw(pbGet(1))
Kernel.pbMessage(_INTL("Se ha sacado a {1}.",pbGet(3)))
end
end
when 3 if $PokemonGlobal.daycareEgg==1
Kernel.pbMessage(_INTL("Ya hay un huevo esperando ser retirado."))
elsif pbDayCareDeposited!=2
Kernel.pbMessage(_INTL("Deben haber dos Pokémon en la guardería para generar un huevo."))
elsif pbDayCareGetCompat==0
Kernel.pbMessage(_INTL("Los Pokémon de la guardería no se pueden reproducir."))
else
$PokemonGlobal.daycareEgg=1
Kernel.pbMessage(_INTL("Ahora hay un huevo esperando ser retirado."))
end
when 4 if $PokemonGlobal.daycareEgg!=1
Kernel.pbMessage(_INTL("No hay ningún huevo disponible."))
elsif $Trainer.party.length>=6
Kernel.pbMessage(_INTL("El equipo está lleno, no se puede retirar el huevo."))
else
pbDayCareGenerateEgg
$PokemonGlobal.daycareEgg=0
$PokemonGlobal.daycareEggSteps=0
Kernel.pbMessage(_INTL("Se ha recogido el huevo de {1}.",
PBSpecies.getName($Trainer.party[$Trainer.party.length-1].species)))
end
when 5 if $PokemonGlobal.daycareEgg!=1
Kernel.pbMessage(_INTL("No hay ningún huevo disponible."))
else
$PokemonGlobal.daycareEgg=0
$PokemonGlobal.daycareEggSteps=0
Kernel.pbMessage(_INTL("El huevo ha sido regalado al criador Pokémon."))
end
end
end
elsif cmd=="quickhatch"
for pokemon in $Trainer.party
pokemon.eggsteps=1 if pokemon.isEgg?
end
Kernel.pbMessage(_INTL("Ahora les queda a todos los huevos del equipo un solo paso para eclosionar."))
elsif cmd=="roamerstatus"
if RoamingSpecies.length==0
Kernel.pbMessage(_INTL("No se definieron Pokémon errantes."))
else
text="\\l[8]"
for i in 0...RoamingSpecies.length
poke=RoamingSpecies[i]
if $game_switches[poke[2]]
status=$PokemonGlobal.roamPokemon[i]
if status==true
if $PokemonGlobal.roamPokemonCaught[i]
text+=_INTL("{1} (Nv.{2}) capturado.",
PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1])
else
text+=_INTL("{1} (Nv.{2}) debilitado.",
PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1])
end
else
curmap=$PokemonGlobal.roamPosition[i]
if curmap
mapinfos=$RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
text+=_INTL("{1} (Nv.{2}) está vagando por el mapa {3} ({4}){5}",
PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1],curmap,
mapinfos[curmap].name,(curmap==$game_map.map_id) ? _INTL("(este mapa)") : "")
else
text+=_INTL("{1} (Nv.{2}) está vagando (mapa no definido).",
PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1])
end
end
else
text+=_INTL("{1} (Nv.{2}) no está vagando (el interruptor {3} está apagado).",
PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1],poke[2])
end
text+="\n" if i<RoamingSpecies.length-1
end
Kernel.pbMessage(text)
end
elsif cmd=="roam"
if RoamingSpecies.length==0
Kernel.pbMessage(_INTL("No se definieron Pokémon errantes."))
else
pbRoamPokemon(true)
$PokemonGlobal.roamedAlready=false
Kernel.pbMessage(_INTL("Los Pokémon continuaron vagando."))
end
elsif cmd=="setencounters"
encdata=load_data("Data/encounters.dat")
oldencdata=Marshal.dump(encdata)
mapedited=false
map=pbDefaultMap()
loop do
map=pbListScreen(_INTL("SETEAR ENCUENTROS"),MapLister.new(map))
break if map<=0
mapedited=true if map==pbDefaultMap()
pbEncounterEditorMap(encdata,map)
end
save_data(encdata,"Data/encounters.dat")
pbSaveEncounterData()
pbClearData()
elsif cmd=="setmetadata"
pbMetadataScreen(pbDefaultMap())
pbClearData()
elsif cmd=="terraintags"
pbFadeOutIn(99999) { pbTilesetScreen }
elsif cmd=="trainertypes"
pbFadeOutIn(99999) { pbTrainerTypeEditor }
elsif cmd=="resettrainers"
if $game_map
for event in $game_map.events.values
if event.name[/Trainer\(\d+\)/]
$game_self_switches[[$game_map.map_id,event.id,"A"]]=false
$game_self_switches[[$game_map.map_id,event.id,"B"]]=false
end
end
$game_map.need_refresh=true
Kernel.pbMessage(_INTL("Todos los entrenadores de este mapa fueron restablecidos."))
else
Kernel.pbMessage(_INTL("Este comando no se puede utilizar aquí."))
end
elsif cmd=="testwildbattle"
species=pbChooseSpeciesOrdered(1)
if species!=0
params=ChooseNumberParams.new
params.setRange(1,PBExperience::MAXLEVEL)
params.setInitialValue(5)
params.setCancelValue(0)
level=Kernel.pbMessageChooseNumber(
_INTL("Indicar el nivel del Pokémon."),params)
if level>0
pbWildBattle(species,level)
end
end
elsif cmd=="testdoublewildbattle"
Kernel.pbMessage(_INTL("Elegir el primer Pokémon."))
species1=pbChooseSpeciesOrdered(1)
if species1!=0
params=ChooseNumberParams.new
params.setRange(1,PBExperience::MAXLEVEL)
params.setInitialValue(5)
params.setCancelValue(0)
level1=Kernel.pbMessageChooseNumber(
_INTL("Indicar el nivel del primer Pokémon."),params)
if level1>0
Kernel.pbMessage(_INTL("Elegir el segundo Pokémon."))
species2=pbChooseSpeciesOrdered(1)
if species2!=0
params=ChooseNumberParams.new
params.setRange(1,PBExperience::MAXLEVEL)
params.setInitialValue(5)
params.setCancelValue(0)
level2=Kernel.pbMessageChooseNumber(
_INTL("Indicar el nivel del segundo Pokémon."),params)
if level2>0
pbDoubleWildBattle(species1,level1,species2,level2)
end
end
end
end
elsif cmd=="testtrainerbattle"
battle=pbListScreen(_INTL("ENTRENADOR INDIVIDUAL"),TrainerBattleLister.new(0,false))
if battle
trainerdata=battle[1]
pbTrainerBattle(trainerdata[0],trainerdata[1],"...",false,trainerdata[4],true)
end
elsif cmd=="testdoubletrainerbattle"
battle1=pbListScreen(_INTL("ENTRENADOR DOBLE 1"),TrainerBattleLister.new(0,false))
if battle1
battle2=pbListScreen(_INTL("ENTRENADOR DOBLE 2"),TrainerBattleLister.new(0,false))
if battle2
trainerdata1=battle1[1]
trainerdata2=battle2[1]
pbDoubleTrainerBattle(trainerdata1[0],trainerdata1[1],trainerdata1[4],"...",
trainerdata2[0],trainerdata2[1],trainerdata2[4],"...",
true)
end
end
elsif cmd=="relicstone"
pbRelicStone()
elsif cmd=="purifychamber"
pbPurifyChamber()
elsif cmd=="extracttext"
elsif cmd=="compiletext"
pbCompileTextUI
elsif cmd=="compiledata"
msgwindow=Kernel.pbCreateMessageWindow
pbCompileAllData(true) {|msg| Kernel.pbMessageDisplay(msgwindow,msg,false) }
Kernel.pbMessageDisplay(msgwindow,_INTL("Se han compilado todos los datos del juego."))
Kernel.pbDisposeMessageWindow(msgwindow)
elsif cmd=="mapconnections"
pbFadeOutIn(99999) { pbEditorScreen }
elsif cmd=="animeditor"
pbFadeOutIn(99999) { pbAnimationEditor }
elsif cmd=="debugconsole"
Console::setup_console
elsif cmd=="togglelogging"
$INTERNAL=!$INTERNAL
Kernel.pbMessage(_INTL("El registro de depuración de batallas se creará en la carpeta Data.")) if $INTERNAL
Kernel.pbMessage(_INTL("No se creará el registro de depuración de batallas.")) if !$INTERNAL
end
end
pbFadeOutAndHide(sprites)
pbDisposeSpriteHash(sprites)
viewport.dispose
end
|
#pbDebugPlayBattle ⇒ Object
673
674
675
676
677
678
679
680
681
682
|
# File 'scripts/PBattle_OrgBattle.rb', line 673
def pbDebugPlayBattle
params=ChooseNumberParams.new
params.setRange(0,500)
params.setInitialValue(0)
params.setCancelValue(-1)
num=Kernel.pbMessageChooseNumber(_INTL("Elegir una batalla."),params)
if num>=0
pbPlayBattleFromFile(sprintf("Battles/Battle%03d.dat",num))
end
end
|
#pbDebugScreen(mode) ⇒ Object
#pbDebugSetVariable(id, diff) ⇒ Object
888
889
890
891
892
893
894
895
|
# File 'scripts/Debug.rb', line 888
def pbDebugSetVariable(id,diff)
pbPlayCursorSE()
$game_variables[id]=0 if $game_variables[id]==nil
if $game_variables[id].is_a?(Numeric)
$game_variables[id]=[$game_variables[id]+diff,99999999].min
$game_variables[id]=[$game_variables[id],-99999999].max
end
end
|
#pbDebugVariableScreen(id) ⇒ Object
897
898
899
900
901
902
903
904
905
906
907
908
909
|
# File 'scripts/Debug.rb', line 897
def pbDebugVariableScreen(id)
value=0
if $game_variables[id].is_a?(Numeric)
value=$game_variables[id]
end
params=ChooseNumberParams.new
params.setDefaultValue(value)
params.setMaxDigits(8)
params.setNegativesAllowed(true)
value=Kernel.pbMessageChooseNumber(_INTL("Establecer variable {1}.",id),params)
$game_variables[id]=[value,99999999].min
$game_variables[id]=[$game_variables[id],-99999999].max
end
|
#pbDecideWinner(party0, party1, rating0, rating1) ⇒ Object
969
970
971
972
973
974
975
976
977
978
979
980
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 969
def pbDecideWinner(party0,party1,rating0,rating1)
rating0=(rating0*15.0/100).round
rating1=(rating1*15.0/100).round
score0=pbDecideWinnerScore(party0,party1,rating0)
score1=pbDecideWinnerScore(party1,party0,rating1)
if score0==score1
return 5 if rating0==rating1
return (rating0>rating1) ? 1 : 2
else
return (score0>score1) ? 1 : 2
end
end
|
#pbDecideWinnerEffectiveness(move, otype1, otype2, ability, scores) ⇒ Object
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 918
def pbDecideWinnerEffectiveness(move,otype1,otype2,ability,scores)
data=moveData(move)
return 0 if data.basedamage==0
atype=data.type
typemod=4
if isConst?(ability,PBAbilities,:LEVITATE) && isConst?(data.type,PBTypes,:GROUND)
typemod=4
else
mod1=PBTypes.getEffectiveness(atype,otype1)
mod2=(otype1==otype2) ? 2 : PBTypes.getEffectiveness(atype,otype2)
if isConst?(ability,PBAbilities,:WONDERGUARD)
mod1=2 if mod1!=4
mod2=2 if mod2!=4
end
typemod=mod1*mod2
end
return scores[0] if typemod==0
return scores[1] if typemod==1
return scores[2] if typemod==2
return scores[3] if typemod==4
return scores[4] if typemod==8
return scores[5] if typemod==16
return 0
end
|
#pbDecideWinnerScore(party0, party1, rating) ⇒ Object
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 943
def pbDecideWinnerScore(party0,party1,rating)
score=0
types1=[]
types2=[]
abilities=[]
for j in 0...party1.length
types1.push(party1[j].type1)
types2.push(party1[j].type2)
abilities.push(party1[j].ability)
end
for i in 0...party0.length
for move in party0[i].moves
next if move.id==0
for j in 0...party1.length
score+=pbDecideWinnerEffectiveness(move.id,
types1[j],types2[j],abilities[j],[-16,-8,0,4,12,20])
end
end
basestatsum=baseStatTotal(party0[i].species)
score+=basestatsum/10
score+=10 if party0[i].item!=0 end
score+=rating+rand(32)
return score
end
|
#pbDefaultMap ⇒ Object
196
197
198
199
200
|
# File 'scripts/Debug.rb', line 196
def pbDefaultMap()
return $game_map.map_id if $game_map
return $data_system.edit_map_id if $data_system
return 0
end
|
#pbDefinePath(canvas) ⇒ Object
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
|
# File 'scripts/BattleAnimationEditor.rb', line 3200
def pbDefinePath(canvas)
sliderwin2=ControlWindow.new(0,0,320,320)
sliderwin2.viewport=canvas.viewport
sliderwin2.addSlider(_INTL("Number of frames:"),2,500,20)
sliderwin2.opacity=200
defcurvebutton=sliderwin2.addButton(_INTL("Define Curve"))
defpathbutton=sliderwin2.addButton(_INTL("Define Path"))
okbutton=sliderwin2.addButton(_INTL("OK"))
cancelbutton=sliderwin2.addButton(_INTL("Cancel"))
points=[]
path=nil
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(0)
if path
path=path.smoothPointPath(sliderwin2.value(0),false)
i=0
for point in path
if i<points.length
points[i].x=point[0]
points[i].y=point[1]
else
points.push(PointSprite.new(point[0],point[1],canvas.viewport))
end
i+=1
end
for j in i...points.length
points[j].dispose
points[j]=nil
end
points.compact!
end
end
if sliderwin2.changed?(okbutton) && path
neededsize=canvas.currentframe+sliderwin2.value(0)
if neededsize>canvas.animation.length
canvas.animation.resize(neededsize)
end
thiscel=canvas.currentCel
celnumber=canvas.currentcel
for i in canvas.currentframe...neededsize
cel=canvas.animation[i][celnumber]
if !canvas.animation[i][celnumber]
cel=pbCreateCel(0,0,thiscel[AnimFrame::PATTERN],canvas.animation.position)
canvas.animation[i][celnumber]=cel
end
cel[AnimFrame::X]=path[i-canvas.currentframe][0]
cel[AnimFrame::Y]=path[i-canvas.currentframe][1]
end
startframe=sliderwin2.value(0)
break
end
if sliderwin2.changed?(defcurvebutton)
for point in points
point.dispose
end
points.clear
30.times do
point=PointSprite.new(0,0,canvas.viewport)
point.visible=false
points.push(point)
end
curve=[
ControlPointSprite.new(true,canvas.viewport),
ControlPointSprite.new(false,canvas.viewport),
ControlPointSprite.new(false,canvas.viewport),
ControlPointSprite.new(true,canvas.viewport)
]
showline=false
sliderwin2.visible=false
window=Window_UnformattedTextPokemon.new("")
window.x=0
window.y=320-64
window.width=128
window.height=64
window.viewport=canvas.viewport
loop do
Graphics.update
Input.update
redrawline=false
if Input.trigger?(Input::B)
break
end
if Input.triggerex?(Input::LeftMouseKey)
for j in 0...4
next if !curve[j].hittest?
if j==1||j==2
next if !curve[0].visible || !curve[3].visible
end
curve[j].visible=true
for k in 0...4
curve[k].dragging=(k==j)
end
break
end
end
for j in 0...4
curve[j].mouseover
end
mouse=Mouse::getMousePos(true)
newtext=sprintf("(%d,%d)",mouse[0],mouse[1])
if window.text!=newtext
window.text=newtext
end
if curve[0].visible && curve[3].visible &&
!curve[0].dragging && !curve[3].dragging
for point in points
point.visible=true
end
if !showline
curve[1].visible=true
curve[2].visible=true
curve[1].x=curve[0].x+0.3333*(curve[3].x-curve[0].x)
curve[1].y=curve[0].y+0.3333*(curve[3].y-curve[0].y)
curve[2].x=curve[0].x+0.6666*(curve[3].x-curve[0].x)
curve[2].y=curve[0].y+0.6666*(curve[3].y-curve[0].y)
end
showline=true
end
if showline
step=1.0/(points.length-1)
t=0.0
for i in 0...points.length
point=getCurvePoint(curve,t)
points[i].x=point[0]
points[i].y=point[1]
t+=step
end
end
end
window.dispose
for point in points
point.dispose
end
points.clear
if showline
path=curveToPointPath(curve,sliderwin2.value(0))
for point in path
points.push(PointSprite.new(point[0],point[1],canvas.viewport))
end
end
for point in curve
point.dispose
end
sliderwin2.visible=true
next
elsif sliderwin2.changed?(defpathbutton)
canceled=false
pointpath=PointPath.new
for point in points
point.dispose
end
points.clear
window=Window_UnformattedTextPokemon.newWithSize("",
0, 320-64, 128, 64, canvas.viewport)
sliderwin2.visible=false
loop do
Graphics.update
Input.update
if Input.triggerex?(0x1b)
canceled=true
break
end
if Input.triggerex?(Input::LeftMouseKey)
break
end
mousepos=Mouse::getMousePos(true)
window.text=sprintf("(%d,%d)",mousepos[0],mousepos[1])
end
while !canceled
mousepos=Mouse::getMousePos(true)
if !pointpath.isEndPoint?(mousepos[0],mousepos[1])
pointpath.addPoint(mousepos[0],mousepos[1])
points.push(PointSprite.new(mousepos[0],mousepos[1],canvas.viewport))
end
window.text=sprintf("(%d,%d)",mousepos[0],mousepos[1])
Graphics.update
Input.update
if Input.triggerex?(0x1b) || Input.repeatcount(0x01)==0
break
end
end
window.dispose
for point in points
point.dispose
end
points.clear
path=pointpath.smoothPointPath(sliderwin2.value(0),true)
for point in path
points.push(PointSprite.new(point[0],point[1],canvas.viewport))
end
sliderwin2.visible=true
next
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
for point in points
point.dispose
end
points.clear
sliderwin2.dispose
return
end
|
#pbDeregisterPartner ⇒ Object
1889
1890
1891
|
# File 'scripts/PField_Field.rb', line 1889
def pbDeregisterPartner
$PokemonGlobal.partner=nil
end
|
#pbDexDataOffset(dexdata, species, offset) ⇒ Object
164
165
166
|
# File 'scripts/MiscData.rb', line 164
def pbDexDataOffset(dexdata,species,offset)
dexdata.pos=76*(species-1)+offset
end
|
#pbDexNames ⇒ Object
200
201
202
203
204
|
# File 'scripts/Settings.rb', line 200
def pbDexNames; return [
[_INTL("Pokédex Kanto"),0],
[_INTL("Pokédex Johto"),1],
_INTL("Pokédex Nacional")
]; end
|
#pbDisplayCoinsWindow(msgwindow, goldwindow) ⇒ Object
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
|
# File 'scripts/Messages.rb', line 1232
def pbDisplayCoinsWindow(msgwindow,goldwindow)
coinString=($PokemonGlobal) ? $PokemonGlobal.coins : "0"
coinwindow=Window_AdvancedTextPokemon.new(_INTL("Fichas:\n<ar>{1}</ar>",coinString))
coinwindow.setSkin("Graphics/Windowskins/goldskin")
coinwindow.resizeToFit(coinwindow.text,Graphics.width)
coinwindow.width=160 if coinwindow.width<=160
if msgwindow.y==0
coinwindow.y=(goldwindow) ? goldwindow.y-coinwindow.height : Graphics.height-coinwindow.height
else
coinwindow.y=(goldwindow) ? goldwindow.height : 0
end
coinwindow.viewport=msgwindow.viewport
coinwindow.z=msgwindow.z
return coinwindow
end
|
#pbDisplayGoldWindow(msgwindow) ⇒ Object
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
|
# File 'scripts/Messages.rb', line 1216
def pbDisplayGoldWindow(msgwindow)
moneyString=pbGetGoldString()
goldwindow=Window_AdvancedTextPokemon.new(_INTL("Dinero:\n<ar>{1}</ar>",moneyString))
goldwindow.setSkin("Graphics/Windowskins/goldskin")
goldwindow.resizeToFit(goldwindow.text,Graphics.width)
goldwindow.width=160 if goldwindow.width<=160
if msgwindow.y==0
goldwindow.y=Graphics.height-goldwindow.height
else
goldwindow.y=0
end
goldwindow.viewport=msgwindow.viewport
goldwindow.z=msgwindow.z
return goldwindow
end
|
#pbDisplayMail(mail, bearer = nil) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'scripts/PItem_Mail.rb', line 31
def pbDisplayMail(mail,bearer=nil)
sprites={}
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
addBackgroundPlane(sprites,"background","mailbg",viewport)
sprites["card"]=IconSprite.new(0,0,viewport)
sprites["card"].setBitmap(pbMailBackFile(mail.item))
sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,viewport)
overlay=sprites["overlay"].bitmap
pbSetSystemFont(overlay)
if $ItemData[mail.item][ITEMTYPE]==2
if mail.poke1
sprites["bearer"]=IconSprite.new(64,288,viewport)
bitmapFileName=pbCheckPokemonIconFiles(mail.poke1,mail.poke1[5])
sprites["bearer"].setBitmap(bitmapFileName)
sprites["bearer"].src_rect.set(0,0,64,64)
end
if mail.poke2
sprites["bearer2"]=IconSprite.new(144,288,viewport)
bitmapFileName=pbCheckPokemonIconFiles(mail.poke2,mail.poke2[5])
sprites["bearer2"].setBitmap(bitmapFileName)
sprites["bearer2"].src_rect.set(0,0,64,64)
end
if mail.poke3
sprites["bearer3"]=IconSprite.new(224,288,viewport)
bitmapFileName=pbCheckPokemonIconFiles(mail.poke3,mail.poke3[5])
sprites["bearer3"].setBitmap(bitmapFileName)
sprites["bearer3"].src_rect.set(0,0,64,64)
end
end
baseForDarkBG=Color.new(248,248,248)
shadowForDarkBG=Color.new(72,80,88)
baseForLightBG=Color.new(80,80,88)
shadowForLightBG=Color.new(168,168,176)
if mail.message && mail.message!=""
isDark=isDarkBackground(sprites["card"].bitmap,Rect.new(48,48,Graphics.width-96,32*7))
drawTextEx(overlay,48,48,Graphics.width-96,7,mail.message,
isDark ? baseForDarkBG : baseForLightBG,
isDark ? shadowForDarkBG : shadowForLightBG)
end
if mail.sender && mail.sender!=""
isDark=isDarkBackground(sprites["card"].bitmap,Rect.new(336,322,144,32*1))
drawTextEx(overlay,336,322,144,1,_INTL("{1}",mail.sender),
isDark ? baseForDarkBG : baseForLightBG,
isDark ? shadowForDarkBG : shadowForLightBG)
end
pbFadeInAndShow(sprites)
loop do
Graphics.update
Input.update
pbUpdateSpriteHash(sprites)
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
break
end
end
pbFadeOutAndHide(sprites)
pbDisposeSpriteHash(sprites)
viewport.dispose
end
|
#pbDisposed?(x) ⇒ Boolean
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
|
# File 'scripts/SpriteWindow.rb', line 1014
def pbDisposed?(x)
return true if !x
if x.is_a?(Viewport)
begin
x.rect=x.rect
rescue
return true
end
return false
else
return x.disposed?
end
end
|
#pbDisposeSprite(sprites, id) ⇒ Object
Disposes the specified graphics object within the specified hash. Basically like:
sprites[id].dispose
1149
1150
1151
1152
1153
1154
1155
|
# File 'scripts/SpriteWindow.rb', line 1149
def pbDisposeSprite(sprites,id)
sprite=sprites[id]
if sprite && !pbDisposed?(sprite)
sprite.dispose
end
sprites[id]=nil
end
|
#pbDisposeSpriteHash(sprites) ⇒ Object
Disposes all objects in the specified hash.
1138
1139
1140
1141
1142
1143
1144
1145
|
# File 'scripts/SpriteWindow.rb', line 1138
def pbDisposeSpriteHash(sprites)
if sprites
for i in sprites.keys
pbDisposeSprite(sprites,i)
end
sprites.clear
end
end
|
#pbDoEnsureBitmap(bitmap, dwidth, dheight) ⇒ Object
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
|
# File 'scripts/SpriteWindow.rb', line 1099
def pbDoEnsureBitmap(bitmap,dwidth,dheight)
if !bitmap || bitmap.disposed? || bitmap.width<dwidth || bitmap.height<dheight
oldfont=(bitmap && !bitmap.disposed?) ? bitmap.font : nil
bitmap.dispose if bitmap
bitmap=Bitmap.new([1,dwidth].max,[1,dheight].max)
if !oldfont
pbSetSystemFont(bitmap)
else
bitmap.font=oldfont
end
if bitmap.font && bitmap.font.respond_to?("shadow")
bitmap.font.shadow=false
end
end
return bitmap
end
|
#pbDoubleTrainerBattle(trainerid1, trainername1, trainerparty1, endspeech1, trainerid2, trainername2, trainerparty2, endspeech2, canlose = false, variable = nil) ⇒ Object
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 381
def pbDoubleTrainerBattle(trainerid1, trainername1, trainerparty1, endspeech1,
trainerid2, trainername2, trainerparty2, endspeech2,
canlose=false,variable=nil)
trainer1=pbLoadTrainer(trainerid1,trainername1,trainerparty1)
Events.onTrainerPartyLoad.trigger(nil,trainer1)
if !trainer1
pbMissingTrainer(trainerid1,trainername1,trainerparty1)
end
trainer2=pbLoadTrainer(trainerid2,trainername2,trainerparty2)
Events.onTrainerPartyLoad.trigger(nil,trainer2)
if !trainer2
pbMissingTrainer(trainerid2,trainername2,trainerparty2)
end
if !trainer1 || !trainer2
return false
end
if $PokemonGlobal.partner
othertrainer=PokeBattle_Trainer.new($PokemonGlobal.partner[1],
$PokemonGlobal.partner[0])
othertrainer.id=$PokemonGlobal.partner[2]
othertrainer.party=$PokemonGlobal.partner[3]
playerparty=[]
for i in 0...$Trainer.party.length
playerparty[i]=$Trainer.party[i]
end
for i in 0...othertrainer.party.length
playerparty[6+i]=othertrainer.party[i]
end
fullparty1=true
playertrainer=[$Trainer,othertrainer]
else
playerparty=$Trainer.party
playertrainer=$Trainer
fullparty1=false
end
combinedParty=[]
for i in 0...trainer1[2].length
combinedParty[i]=trainer1[2][i]
end
for i in 0...trainer2[2].length
combinedParty[6+i]=trainer2[2][i]
end
scene=pbNewBattleScene
battle=PokeBattle_Battle.new(scene,
playerparty,combinedParty,playertrainer,[trainer1[0],trainer2[0]])
trainerbgm=pbGetTrainerBattleBGM([trainer1[0],trainer2[0]])
battle.fullparty1=fullparty1
battle.fullparty2=true
battle.doublebattle=battle.pbDoubleBattleAllowed?()
battle.endspeech=endspeech1
battle.endspeech2=endspeech2
battle.items=[trainer1[1],trainer2[1]]
if Input.press?(Input::CTRL) && $DEBUG
Kernel.pbMessage(_INTL("SALTANDO COMBATES..."))
Kernel.pbMessage(_INTL("TRAS PERDER..."))
Kernel.pbMessage(battle.endspeech)
Kernel.pbMessage(battle.endspeech2) if battle.endspeech2 && battle.endspeech2!=""
return true
end
Events.onStartBattle.trigger(nil,nil)
battle.internalbattle=true
pbPrepareBattle(battle)
restorebgm=true
decision=0
pbBattleAnimation(trainerbgm) {
pbSceneStandby {
decision=battle.pbStartBattle(canlose)
}
for i in $Trainer.party; (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); end
if $PokemonGlobal.partner
pbHealAll
for i in $PokemonGlobal.partner[3]
i.heal
i.makeUnmega rescue nil
i.makeUnprimal rescue nil
end
end
if decision==2 || decision==5
if canlose
for i in $Trainer.party; i.heal; end
for i in 0...10
Graphics.update
end
end
end
Events.onEndBattle.trigger(nil,decision,canlose)
}
Input.update
pbSet(variable,decision)
return (decision==1)
end
|
#pbDoubleWildBattle(species1, level1, species2, level2, variable = nil, canescape = true, canlose = false) ⇒ Object
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
|
# File 'scripts/PField_Field.rb', line 938
def pbDoubleWildBattle(species1,level1,species2,level2,variable=nil,canescape=true,canlose=false)
if (Input.press?(Input::CTRL) && $DEBUG) || $Trainer.pokemonCount==0
if $Trainer.pokemonCount>0
Kernel.pbMessage(_INTL("SALTANDO BATALLA..."))
end
pbSet(variable,1)
$PokemonGlobal.nextBattleBGM=nil
$PokemonGlobal.nextBattleME=nil
$PokemonGlobal.nextBattleBack=nil
return true
end
if species1.is_a?(String) || species1.is_a?(Symbol)
species1=getID(PBSpecies,species1)
end
if species2.is_a?(String) || species2.is_a?(Symbol)
species2=getID(PBSpecies,species2)
end
currentlevels=[]
for i in $Trainer.party
currentlevels.push(i.level)
end
genwildpoke=pbGenerateWildPokemon(species1,level1)
genwildpoke2=pbGenerateWildPokemon(species2,level2)
Events.onStartBattle.trigger(nil,genwildpoke)
scene=pbNewBattleScene
if $PokemonGlobal.partner
othertrainer=PokeBattle_Trainer.new(
$PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
othertrainer.id=$PokemonGlobal.partner[2]
othertrainer.party=$PokemonGlobal.partner[3]
combinedParty=[]
for i in 0...$Trainer.party.length
combinedParty[i]=$Trainer.party[i]
end
for i in 0...othertrainer.party.length
combinedParty[6+i]=othertrainer.party[i]
end
battle=PokeBattle_Battle.new(scene,combinedParty,[genwildpoke,genwildpoke2],
[$Trainer,othertrainer],nil)
battle.fullparty1=true
else
battle=PokeBattle_Battle.new(scene,$Trainer.party,[genwildpoke,genwildpoke2],
$Trainer,nil)
battle.fullparty1=false
end
battle.internalbattle=true
battle.doublebattle=battle.pbDoubleBattleAllowed?()
battle.cantescape=!canescape
pbPrepareBattle(battle)
decision=0
pbBattleAnimation(pbGetWildBattleBGM(species1)) {
pbSceneStandby {
decision=battle.pbStartBattle(canlose)
}
for i in $Trainer.party; (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); (i.revertOtherForms rescue nil); end
if $PokemonGlobal.partner
pbHealAll
for i in $PokemonGlobal.partner[3]
i.heal
(i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); (i.revertOtherForms rescue nil);
end
end
if decision==2 || decision==5
if canlose
for i in $Trainer.party;
i.heal; end
(i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); (i.revertOtherForms rescue nil);
for i in 0...10
Graphics.update
end
end
end
Events.onEndBattle.trigger(nil,decision,canlose)
}
Input.update
pbSet(variable,decision)
return (decision!=2 && decision!=5)
end
|
#pbDownloadData(url, filename = nil, depth = 0) ⇒ Object
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
# File 'scripts/Sockets.rb', line 567
def pbDownloadData(url, filename=nil, depth=0)
userAgent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
if depth>10
raise "Redirection level too deep"
end
if url[/^http:\/\/([^\/]+)(.*)$/]
host=$1
path=$2
path="/" if path.length==0
request="GET #{path} HTTP/1.1\nUser-Agent: #{userAgent}\nPragma: no-cache\nHost: #{host}\nProxy-Connection: Close\n\n"
return pbHttpRequest(host, request, filename, depth)
end
return ""
end
|
#pbDownloadMysteryGift(trainer) ⇒ Object
Downloads all available Mystery Gifts that haven't been downloaded yet.
Called from the Continue/New Game screen.
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
# File 'scripts/PScreen_MysteryGift.rb', line 262
def pbDownloadMysteryGift(trainer)
sprites={}
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
addBackgroundPlane(sprites,"background","mysteryGiftbg",viewport)
pbFadeInAndShow(sprites)
sprites["msgwindow"]=Kernel.pbCreateMessageWindow
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("Buscando regalos.\nEspere un momento...\\wtnp[0]"))
string=pbDownloadToString(MYSTERYGIFTURL)
if string==""
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("No hay regalos nuevos disponibles."))
else
online=pbMysteryGiftDecrypt(string)
pending=[]
for gift in online
notgot=true
for j in trainer.mysterygift
notgot=false if j[0]==gift[0]
end
pending.push(gift) if notgot
end
if pending.length==0
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("No hay regalos nuevos disponibles."))
else
loop do
commands=[]
for gift in pending; commands.push(gift[3]); end
commands.push(_INTL("Salir"))
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("Elige el regalo que quieres recibir.\\wtnp[0]"))
command=Kernel.pbShowCommands(sprites["msgwindow"],commands,-1)
if command==-1 || command==commands.length-1
break
else
gift=pending[command]
sprites["msgwindow"].visible=false
isitem=false
if gift[1]==0
sprite=PokemonSprite.new(viewport)
sprite.setPokemonBitmap(gift[2])
sprite.ox=sprite.bitmap.width/2
sprite.oy=sprite.bitmap.height/2
sprite.x=Graphics.width/2
sprite.y=-sprite.bitmap.height/2
else
sprite=ItemIconSprite.new(0,0,gift[2],viewport)
sprite.x=Graphics.width/2
sprite.y=-sprite.height/2
isitem=true
end
begin
Graphics.update
Input.update
sprite.update
sprite.y+=4
end while sprite.y<Graphics.height/2
pbMEPlay("Jingle - HMTM")
3*Graphics.frame_rate.times do
Graphics.update
Input.update
sprite.update
pbUpdateSceneMap
end
sprites["msgwindow"].visible=true
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("¡Se ha recibido el regalo!")) { sprite.update }
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("Retira tu regalo del repartidor en cualquier Tienda.")) { sprite.update }
trainer.mysterygift.push(gift)
pending[command]=nil; pending.compact!
begin
Graphics.update
Input.update
sprite.update
sprite.opacity-=8
end while sprite.opacity>0
sprite.dispose
end
if pending.length==0
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("No hay regalos nuevos disponibles."))
break
end
end
end
end
pbFadeOutAndHide(sprites)
Kernel.pbDisposeMessageWindow(sprites["msgwindow"])
pbDisposeSpriteHash(sprites)
viewport.dispose
return trainer
end
|
#pbDownloadToFile(url, file) ⇒ Object
680
681
682
683
684
685
|
# File 'scripts/Sockets.rb', line 680
def pbDownloadToFile(url, file)
begin
pbDownloadData(url,file)
rescue
end
end
|
#pbDownloadToString(url) ⇒ Object
671
672
673
674
675
676
677
678
|
# File 'scripts/Sockets.rb', line 671
def pbDownloadToString(url)
begin
data=pbDownloadData(url)
return data
rescue
return ""
end
end
|
#pbDrawGauge(bitmap, rect, color, value, maxValue) ⇒ Object
General purpose utilities
289
290
291
292
293
294
295
296
297
|
# File 'scripts/PScreen_PurifyChamber.rb', line 289
def pbDrawGauge(bitmap,rect,color,value,maxValue)
return if !bitmap
bitmap.fill_rect(rect.x,rect.y,rect.width,rect.height,Color.new(0,0,0))
width=(maxValue<=0) ? 0 : (rect.width-4)*value/maxValue
if rect.width>=4 && rect.height>=4
bitmap.fill_rect(rect.x+2,rect.y+2,rect.width-4,rect.height-4,Color.new(248,248,248))
bitmap.fill_rect(rect.x+2,rect.y+2,width,rect.height-4,color)
end
end
|
#pbDrawImagePositions(bitmap, textpos) ⇒ Object
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
|
# File 'scripts/SpriteWindow.rb', line 1185
def pbDrawImagePositions(bitmap,textpos)
for i in textpos
srcbitmap=AnimatedBitmap.new(pbBitmapName(i[0]))
x=i[1]
y=i[2]
srcx=i[3]
srcy=i[4]
width=i[5]>=0 ? i[5] : srcbitmap.width
height=i[6]>=0 ? i[6] : srcbitmap.height
srcrect=Rect.new(srcx,srcy,width,height)
bitmap.blt(x,y,srcbitmap.bitmap,srcrect)
srcbitmap.dispose
end
end
|
#pbDrawOutlineText(bitmap, x, y, width, height, string, baseColor, shadowColor = nil, align = 0) ⇒ Object
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
|
# File 'scripts/SpriteWindow.rb', line 963
def pbDrawOutlineText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,align=0)
return if !bitmap || !string
width=(width<0) ? bitmap.text_size(string).width+4 : width
height=(height<0) ? bitmap.text_size(string).height+4 : height
if shadowColor
bitmap.font.color=shadowColor
bitmap.draw_text(x-2,y-2,width,height,string,align)
bitmap.draw_text(x,y-2,width,height,string,align)
bitmap.draw_text(x+2,y-2,width,height,string,align)
bitmap.draw_text(x-2,y,width,height,string,align)
bitmap.draw_text(x+2,y,width,height,string,align)
bitmap.draw_text(x-2,y+2,width,height,string,align)
bitmap.draw_text(x,y+2,width,height,string,align)
bitmap.draw_text(x+2,y+2,width,height,string,align)
end
if baseColor
bitmap.font.color=baseColor
bitmap.draw_text(x,y,width,height,string,align)
end
end
|
#pbDrawShadow(bitmap, x, y, width, height, string) ⇒ Object
942
943
944
945
|
# File 'scripts/SpriteWindow.rb', line 942
def pbDrawShadow(bitmap,x,y,width,height,string)
return if !bitmap || !string
pbDrawShadowText(bitmap,x,y,width,height,string,nil,bitmap.font.color)
end
|
#pbDrawShadowText(bitmap, x, y, width, height, string, baseColor, shadowColor = nil, align = 0) ⇒ Object
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
|
# File 'scripts/SpriteWindow.rb', line 947
def pbDrawShadowText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,align=0)
return if !bitmap || !string
width=(width<0) ? bitmap.text_size(string).width+4 : width
height=(height<0) ? bitmap.text_size(string).height+4 : height
if shadowColor
bitmap.font.color=shadowColor
bitmap.draw_text(x+2,y,width,height,string,align)
bitmap.draw_text(x,y+2,width,height,string,align)
bitmap.draw_text(x+2,y+2,width,height,string,align)
end
if baseColor
bitmap.font.color=baseColor
bitmap.draw_text(x,y,width,height,string,align)
end
end
|
#pbDrawTextPositions(bitmap, textpos) ⇒ Object
Draws text on a bitmap. textpos is an array of text commands. Each text command is an array that contains the following:
0 - Text to draw
1 - X coordinate
2 - Y coordinate
3 - If true or 1, the text is right aligned. If 2, the text is centered.
Otherwise, the text is left aligned.
4 - Base color
5 - Shadow color
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
|
# File 'scripts/SpriteWindow.rb', line 1167
def pbDrawTextPositions(bitmap,textpos)
for i in textpos
textsize=bitmap.text_size(i[0])
x=i[1]
y=i[2]
if i[3]==true || i[3]==1 x-=textsize.width
elsif i[3]==2 x-=(textsize.width/2)
end
if i[6]==true || i[6]==1 pbDrawOutlineText(bitmap,x,y,textsize.width,textsize.height,i[0],i[4],i[5])
else
pbDrawShadowText(bitmap,x,y,textsize.width,textsize.height,i[0],i[4],i[5])
end
end
end
|
#pbDynamicItemList(*args) ⇒ Object
1060
1061
1062
1063
1064
1065
1066
1067
1068
|
# File 'scripts/PField_Field.rb', line 1060
def pbDynamicItemList(*args)
ret=[]
for i in 0...args.length
if hasConst?(PBItems,args[i])
ret.push(getConst(PBItems,args[i].to_sym))
end
end
return ret
end
|
254
255
256
257
258
259
260
261
262
263
264
265
|
# File 'scripts/Compiler.rb', line 254
def (f)
lineno=1
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
if !line[/^\#/] && !line[/^\s*$/]
yield line, lineno
end
lineno+=1
}
end
|
#pbEachFileSection(f) ⇒ Object
212
213
214
215
216
217
218
|
# File 'scripts/Compiler.rb', line 212
def pbEachFileSection(f)
pbEachFileSectionEx(f) {|section,name|
if block_given? && name[/^\d+$/]
yield section,name.to_i
end
}
end
|
#pbEachFileSectionEx(f) ⇒ Object
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'scripts/Compiler.rb', line 168
def pbEachFileSectionEx(f)
lineno=1
havesection=false
sectionname=nil
lastsection={}
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
if !line[/^\#/] && !line[/^\s*$/]
if line[/^\s*\[\s*(.*)\s*\]\s*$/]
if havesection
yield lastsection,sectionname
end
sectionname=$~[1]
havesection=true
lastsection={}
else
if sectionname==nil
FileLineData.setLine(line,lineno)
raise _INTL("Se esperaba una sección al inicio del archivo. Este error también puede ocurrir si el archivo no ha sido guardado en codificación UTF-8.\r\n{1}",FileLineData.linereport)
end
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
FileLineData.setSection(sectionname,nil,line)
raise _INTL("Sintaxis de línea errónea (se esperaba línea con formato XXX=YYY)\r\n{1}",FileLineData.linereport)
end
r1=$~[1]
r2=$~[2]
lastsection[r1]=r2.gsub(/\s+$/,"")
end
end
lineno+=1
if lineno%500==0
Graphics.update
end
if lineno%50==0
Win32API.SetWindowText(_INTL("Procesando linea {1}",lineno))
end
}
if havesection
yield lastsection,sectionname
end
end
|
#pbEachIntlSection(file) ⇒ Object
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
# File 'scripts/Intl_Messages.rb', line 186
def pbEachIntlSection(file)
lineno=1
re=/^\s*\[\s*([^\]]+)\s*\]\s*$/
havesection=false
sectionname=nil
lastsection=[]
file.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
if !line[/^\#/] && !line[/^\s*$/]
if line[re]
if havesection
yield lastsection,sectionname
end
lastsection.clear
sectionname=$~[1]
havesection=true
else
if sectionname==nil
raise _INTL("Se esperaba una identificación de sección al inicio del archivo (línea {1})",lineno)
end
lastsection.push(line.gsub(/\s+$/,""))
end
end
lineno+=1
if lineno%500==0
Graphics.update
end
}
if havesection
yield lastsection,sectionname
end
end
|
#pbEachNaturalMove(pokemon) ⇒ Object
1
2
3
4
5
6
|
# File 'scripts/PScreen_MoveRelearner.rb', line 1
def pbEachNaturalMove(pokemon)
movelist=pokemon.getMoveList
for i in movelist
yield i[1],i[0]
end
end
|
#pbEachPage(e) ⇒ Object
3344
3345
3346
3347
3348
3349
3350
3351
|
# File 'scripts/Compiler.rb', line 3344
def pbEachPage(e)
return true if !e
if e.is_a?(RPG::CommonEvent)
yield e
else
e.pages.each {|page| yield page }
end
end
|
#pbEachPreppedLine(f) ⇒ Object
284
285
286
287
288
289
290
291
292
293
294
295
296
|
# File 'scripts/Compiler.rb', line 284
def pbEachPreppedLine(f)
lineno=1
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
line=prepline(line)
if !line[/^\#/] && !line[/^\s*$/]
yield line, lineno
end
lineno+=1
}
end
|
#pbEachSection(f) ⇒ Object
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
# File 'scripts/Compiler.rb', line 220
def pbEachSection(f)
lineno=1
havesection=false
sectionname=nil
lastsection=[]
f.each_line {|line|
if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
line=line[3,line.length-3]
end
if !line[/^\#/] && !line[/^\s*$/]
if line[/^\s*\[\s*(.+?)\s*\]\s*$/]
if havesection
yield lastsection,sectionname
end
sectionname=$~[1]
lastsection=[]
havesection=true
else
if sectionname==nil
raise _INTL("Se esperaba una sección al inicio del archivo (línea {1}). La sección inicia con '[nombre de sección]'",lineno)
end
lastsection.push(line.gsub(/^\s+/,"").gsub(/\s+$/,""))
end
end
lineno+=1
if lineno%500==0
Graphics.update
end
}
if havesection
yield lastsection,sectionname
end
end
|
#pbEditBG(canvas, timing) ⇒ Object
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
|
# File 'scripts/BattleAnimationEditor.rb', line 2390
def pbEditBG(canvas,timing)
ret=false
maxsizewindow=ControlWindow.new(0,0,320,32*11)
maxsizewindow.addSlider(_INTL("Duration:"),0,50,timing.duration)
maxsizewindow.addOptionalSlider(_INTL("X:"),-500,500,timing.bgX || 0)
maxsizewindow.addOptionalSlider(_INTL("Y:"),-500,500,timing.bgY || 0)
maxsizewindow.addOptionalSlider(_INTL("Opacity:"),0,255,timing.opacity || 0)
maxsizewindow.addOptionalSlider(_INTL("Red:"),0,255,timing.colorRed || 0)
maxsizewindow.addOptionalSlider(_INTL("Green:"),0,255,timing.colorGreen || 0)
maxsizewindow.addOptionalSlider(_INTL("Blue:"),0,255,timing.colorBlue || 0)
maxsizewindow.addOptionalSlider(_INTL("Alpha:"),0,255,timing.colorAlpha || 0)
maxsizewindow.addButton(_INTL("Aceptar"))
maxsizewindow.addButton(_INTL("Salir"))
maxsizewindow.controls[1].checked=(timing.bgX!=nil)
maxsizewindow.controls[2].checked=(timing.bgY!=nil)
maxsizewindow.controls[3].checked=(timing.opacity!=nil)
maxsizewindow.controls[4].checked=(timing.colorRed!=nil)
maxsizewindow.controls[5].checked=(timing.colorGreen!=nil)
maxsizewindow.controls[6].checked=(timing.colorBlue!=nil)
maxsizewindow.controls[7].checked=(timing.colorAlpha!=nil)
maxsizewindow.opacity=200
maxsizewindow.viewport=canvas.viewport
loop do
Graphics.update
Input.update
maxsizewindow.update
if maxsizewindow.changed?(8) if maxsizewindow.controls[1].checked ||
maxsizewindow.controls[2].checked ||
maxsizewindow.controls[3].checked ||
maxsizewindow.controls[4].checked ||
maxsizewindow.controls[5].checked ||
maxsizewindow.controls[6].checked ||
maxsizewindow.controls[7].checked
timing.duration=maxsizewindow.value(0)
timing.bgX=maxsizewindow.value(1)
timing.bgY=maxsizewindow.value(2)
timing.opacity=maxsizewindow.value(3)
timing.colorRed=maxsizewindow.value(4)
timing.colorGreen=maxsizewindow.value(5)
timing.colorBlue=maxsizewindow.value(6)
timing.colorAlpha=maxsizewindow.value(7)
ret=true
break
else
break
end
end
if maxsizewindow.changed?(9) break
end
if Input.trigger?(Input::B)
break
end
end
maxsizewindow.dispose
return ret
end
|
#pbEditEncounterType(enc, etype) ⇒ Object
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
|
# File 'scripts/Editor.rb', line 2269
def pbEditEncounterType(enc,etype)
commands=[]
cmdwin=pbListWindow([])
chances=EncounterTypes::EnctypeChances[etype]
chancetotal=0
chances.each {|a| chancetotal+=a}
enctype=enc[1][etype]
for i in 0...chances.length
enctype[i]=[1,5,5] if !enctype[i]
end
ret=0
loop do
commands.clear
for i in 0...enctype.length
ch=chances[i]
ch=sprintf("%.1f",100.0*chances[i]/chancetotal) if chancetotal!=100
if enctype[i][1]==enctype[i][2]
commands.push(_INTL("{1}% {2} (Nv.{3})",
ch,PBSpecies.getName(enctype[i][0]),
enctype[i][1]
))
else
commands.push(_INTL("{1}% {2} (Nv.{3}-Nv.{4})",
ch,PBSpecies.getName(enctype[i][0]),
enctype[i][1],
enctype[i][2]
))
end
end
ret=pbCommands2(cmdwin,commands,-1,ret)
break if ret<0
species=pbChooseSpecies(enctype[ret][0])
next if species<=0
enctype[ret][0]=species if species>0
minlevel=0
maxlevel=0
params=ChooseNumberParams.new
params.setRange(1,PBExperience::MAXLEVEL)
params.setDefaultValue(enctype[ret][1])
minlevel=Kernel.pbMessageChooseNumber(_INTL("Establecer el nivel mínimo."),params)
params=ChooseNumberParams.new
params.setRange(minlevel,PBExperience::MAXLEVEL)
params.setDefaultValue(minlevel)
maxlevel=Kernel.pbMessageChooseNumber(_INTL("Establecer el nivel máximo."),params)
enctype[ret][1]=minlevel
enctype[ret][2]=maxlevel
end
cmdwin.dispose
end
|
#pbEditMysteryGift(type, item, id = 0, giftname = "") ⇒ Object
Creating a new Mystery Gift for the Master file, and editing an existing one.
type: 0=Pokémon; 1 or higher=item (is the item's quantity). item: The thing being turned into a Mystery Gift (Pokémon object or item ID).
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'scripts/PScreen_MysteryGift.rb', line 34
def pbEditMysteryGift(type,item,id=0,giftname="")
begin
if type==0 commands=[_INTL("Regalo Misterioso"),
_INTL("Faraway place")]
commands.push(item.obtainText) if item.obtainText && item.obtainText!=""
commands.push(_INTL("[Personalizado]"))
loop do
command=Kernel.pbMessage(
_INTL("Choose a phrase to be where the gift Pokémon was obtained from."),commands)
if command>=0 && command<commands.length-1
item.obtainText=commands[command]
break
elsif command==commands.length-1
obtainname=Kernel.pbMessageFreeText(_INTL("Ingresa una nota."),"",false,32)
if obtainname!=""
item.obtainText=obtainname
break
end
return nil if Kernel.pbConfirmMessage(_INTL("¿Dejar de editar el regalo?"))
elsif command==-1
return nil if Kernel.pbConfirmMessage(_INTL("¿Dejar de editar el regalo?"))
end
end
elsif type>0 params=ChooseNumberParams.new
params.setRange(1,99999)
params.setDefaultValue(type)
params.setCancelValue(0)
loop do
newtype=Kernel.pbMessageChooseNumber(_INTL("Elige una cantidad."),params)
if newtype==0
return nil if Kernel.pbConfirmMessage(_INTL("¿Dejar de editar el regalo?"))
else
type=newtype
break
end
end
end
if id==0
master=[]; idlist=[]
if safeExists?("MysteryGiftMaster.txt")
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
end
for i in master; idlist.push(i[0]); end
params=ChooseNumberParams.new
params.setRange(0,99999)
params.setDefaultValue(id)
params.setCancelValue(0)
loop do
newid=Kernel.pbMessageChooseNumber(_INTL("Elige un ID único para este regalo."),params)
if newid==0
return nil if Kernel.pbConfirmMessage(_INTL("¿Dejar de editar el regalo?"))
else
if idlist.include?(newid)
Kernel.pbMessage(_INTL("Ese ID ya está siendo usado por un Regalo Misterioso."))
else
id=newid
break
end
end
end
end
loop do
newgiftname=Kernel.pbMessageFreeText(_INTL("Ingresa un nombre para este regalo."),giftname,false,32)
if newgiftname!=""
giftname=newgiftname
break
end
return nil if Kernel.pbConfirmMessage(_INTL("¿Dejar de editar el regalo?"))
end
return [id,type,item,giftname]
rescue
Kernel.pbMessage(_INTL("No se pudo editar el regalo."))
return nil
end
end
|
#pbEditorScreen ⇒ Object
4037
4038
4039
4040
4041
4042
4043
4044
|
# File 'scripts/Editor.rb', line 4037
def pbEditorScreen
pbCriticalCode {
mapscreen=MapScreenScene.new
mapscreen.mapScreen
mapscreen.pbMapScreenLoop
mapscreen.close
}
end
|
#pbEggGenerated? ⇒ Boolean
1
2
3
4
|
# File 'scripts/PField_DayCare.rb', line 1
def pbEggGenerated?
return false if pbDayCareDeposited!=2
return $PokemonGlobal.daycareEgg==1
end
|
#pbEmergencySave ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'scripts/PScreen_Save.rb', line 34
def pbEmergencySave
oldscene=$scene
$scene=nil
Kernel.pbMessage(_INTL("El script está tomando demasiado tiempo. Se reiniciará el juego."))
return if !$Trainer
if safeExists?(RTP.getSaveFileName("Game.rxdata"))
File.open(RTP.getSaveFileName("Game.rxdata"), 'rb') {|r|
File.open(RTP.getSaveFileName("Game.rxdata.bak"), 'wb') {|w|
while s = r.read(4096)
w.write s
end
}
}
end
if pbSave
Kernel.pbMessage(_INTL("\\se[]Se guardó la partida.\\se[save]\\wtnp[30]"))
else
Kernel.pbMessage(_INTL("\\se[]Error al guardar.\\wtnp[30]"))
end
$scene=oldscene
end
|
#pbEncounter(enctype) ⇒ Object
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
|
# File 'scripts/PField_Field.rb', line 1140
def pbEncounter(enctype)
if $PokemonGlobal.partner
encounter1=$PokemonEncounters.pbEncounteredPokemon(enctype)
return false if !encounter1
encounter2=$PokemonEncounters.pbEncounteredPokemon(enctype)
return false if !encounter2
$PokemonTemp.encounterType=enctype
pbDoubleWildBattle(encounter1[0],encounter1[1],encounter2[0],encounter2[1])
$PokemonTemp.encounterType=-1
return true
else
encounter=$PokemonEncounters.pbEncounteredPokemon(enctype)
return false if !encounter
$PokemonTemp.encounterType=enctype
pbWildBattle(encounter[0],encounter[1])
$PokemonTemp.encounterType=-1
return true
end
end
|
#pbEncounterEditorDensity(enc) ⇒ Object
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
|
# File 'scripts/Editor.rb', line 2319
def pbEncounterEditorDensity(enc)
params=ChooseNumberParams.new
params.setRange(0,100)
params.setDefaultValue(enc[0][EncounterTypes::Land])
enc[0][EncounterTypes::Land]=Kernel.pbMessageChooseNumber(
_INTL("Establecer la densidad de Pokémon en tierra (por defecto {1}).",
EncounterTypes::EnctypeDensities[EncounterTypes::Land]),params)
params=ChooseNumberParams.new
params.setRange(0,100)
params.setDefaultValue(enc[0][EncounterTypes::Cave])
enc[0][EncounterTypes::Cave]=Kernel.pbMessageChooseNumber(
_INTL("Establecer la densidad de Pokémon en cuevas (por defecto {1}).",
EncounterTypes::EnctypeDensities[EncounterTypes::Cave]),params)
params=ChooseNumberParams.new
params.setRange(0,100)
params.setDefaultValue(enc[0][EncounterTypes::Water])
enc[0][EncounterTypes::Water]=Kernel.pbMessageChooseNumber(
_INTL("Establecer la densidad de Pokémon en agua (por defecto {1}).",
EncounterTypes::EnctypeDensities[EncounterTypes::Water]),params)
for i in 0...EncounterTypes::EnctypeCompileDens.length
t=EncounterTypes::EnctypeCompileDens[i]
next if !t || t==0
enc[0][i]=enc[0][EncounterTypes::Land] if t==1
enc[0][i]=enc[0][EncounterTypes::Cave] if t==2
enc[0][i]=enc[0][EncounterTypes::Water] if t==3
end
end
|
#pbEncounterEditorMap(encdata, map) ⇒ Object
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
|
# File 'scripts/Editor.rb', line 2347
def pbEncounterEditorMap(encdata,map)
enccmd=pbListWindow([])
enchelp=Window_UnformattedTextPokemon.new("")
enchelp.z=99999
enchelp.x=256
enchelp.y=0
enchelp.width=224
enchelp.height=96
mapinfos=load_data("Data/MapInfos.rxdata")
mapname=mapinfos[map].name
lastchoice=0
loop do
enc=encdata[map]
enchelp.text=_INTL("{1}",mapname)
choice=pbEncounterEditorTypes(enc,enccmd)
if !enc
enc=[EncounterTypes::EnctypeDensities.clone,[]]
encdata[map]=enc
end
if choice==-2
pbEncounterEditorDensity(enc)
elsif choice==-1
break
elsif choice==-3
ret=pbNewEncounterType(enc)
if ret>=0
enchelp.text=_INTL("{1}\r\n{2}",mapname,EncounterTypes::Names[ret])
pbEditEncounterType(enc,ret)
end
else
enchelp.text=_INTL("{1}\r\n{2}",mapname,EncounterTypes::Names[choice])
pbEditEncounterType(enc,choice)
end
end
if encdata[map][1].length==0
encdata[map]=nil
end
enccmd.dispose
enchelp.dispose
Input.update
end
|
#pbEncounterEditorTypes(enc, enccmd) ⇒ Object
Encounters editor / Editor de encuentros
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
|
# File 'scripts/Editor.rb', line 2166
def pbEncounterEditorTypes(enc,enccmd)
commands=[]
indexes=[]
haveblank=false
if enc
commands.push(_INTL("Densidad: {1},{2},{3}",
enc[0][EncounterTypes::Land],
enc[0][EncounterTypes::Cave],
enc[0][EncounterTypes::Water]))
indexes.push(-2)
for i in 0...EncounterTypes::EnctypeChances.length
if enc[1][i]
commands.push(EncounterTypes::Names[i])
indexes.push(i)
else
haveblank=true
end
end
else
commands.push(_INTL("Densidad: Aún no definida"))
indexes.push(-2)
haveblank=true
end
if haveblank
commands.push(_INTL("[Nuevo Tipo de Encuentro]"))
indexes.push(-3)
end
enccmd.z=99999
enccmd.visible=true
enccmd.commands=commands
enccmd.height=Graphics.height if enccmd.height>Graphics.height
enccmd.x=0
enccmd.y=0
enccmd.active=true
enccmd.index=0
ret=0
command=0
loop do
Graphics.update
Input.update
enccmd.update
if Input.trigger?(Input::A) && indexes[enccmd.index]>=0
if Kernel.pbConfirmMessage(_INTL("¿Borrar el tipo de encuentro {1}?",commands[enccmd.index]))
enc[1][indexes[enccmd.index]]=nil
commands.delete_at(enccmd.index)
indexes.delete_at(enccmd.index)
enccmd.commands=commands
if enccmd.index>=enccmd.commands.length
enccmd.index=enccmd.commands.length
end
end
end
if Input.trigger?(Input::B)
command=-1
break
end
if Input.trigger?(Input::C) || (enccmd.doubleclick? rescue false)
command=enccmd.index
break
end
end
ret=command
enccmd.active=false
return ret<0 ? -1 : indexes[ret]
end
|
#pbEncounterSpecies(phonenum) ⇒ Object
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
# File 'scripts/PScreen_Phone.rb', line 259
def pbEncounterSpecies(phonenum)
return "" if !phonenum[6] || phonenum[6]==0
begin
data=load_data("Data/encounters.dat")
return "" if !data
enctypes=data[phonenum[6]][1]
rescue
return ""
end
species=pbRandomEncounterSpecies(enctypes[0]) species=pbRandomEncounterSpecies(enctypes[1]) if species==0 species=pbRandomEncounterSpecies(enctypes[9]) if species==0 species=pbRandomEncounterSpecies(enctypes[10]) if species==0 species=pbRandomEncounterSpecies(enctypes[11]) if species==0 species=pbRandomEncounterSpecies(enctypes[2]) if species==0 return "" if species==0
return PBSpecies.getName(species)
end
|
#pbEndSurf(xOffset, yOffset) ⇒ Object
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|
# File 'scripts/PField_HiddenMoves.rb', line 523
def pbEndSurf(xOffset,yOffset)
return false if !$PokemonGlobal.surfing
x=$game_player.x
y=$game_player.y
currentTag=$game_map.terrain_tag(x,y)
facingTag=Kernel.pbFacingTerrainTag
if PBTerrain.isSurfable?(currentTag) && !PBTerrain.isSurfable?(facingTag)
if Kernel.pbJumpToward(1,false,true)
$game_map.autoplayAsCue
$game_player.increase_steps
result=$game_player.check_event_trigger_here([1,2])
Kernel.pbOnStepTaken(result)
end
return true
end
return false
end
|
#pbEnterBoxName(helptext, minlength, maxlength, initialText = "", nofadeout = false) ⇒ Object
1625
1626
1627
|
# File 'scripts/TextEntry.rb', line 1625
def pbEnterBoxName(helptext,minlength,maxlength,initialText="",nofadeout=false)
return pbEnterText(helptext,minlength,maxlength,initialText,3,nil,nofadeout)
end
|
#pbEnterNPCName(helptext, minlength, maxlength, initialText = "", id = 0, nofadeout = false) ⇒ Object
1629
1630
1631
|
# File 'scripts/TextEntry.rb', line 1629
def pbEnterNPCName(helptext,minlength,maxlength,initialText="",id=0,nofadeout=false)
return pbEnterText(helptext,minlength,maxlength,initialText,4,id,nofadeout)
end
|
#pbEnterPlayerName(helptext, minlength, maxlength, initialText = "", nofadeout = false) ⇒ Object
1617
1618
1619
|
# File 'scripts/TextEntry.rb', line 1617
def pbEnterPlayerName(helptext,minlength,maxlength,initialText="",nofadeout=false)
return pbEnterText(helptext,minlength,maxlength,initialText,1,nil,nofadeout)
end
|
#pbEnterPokemonName(helptext, minlength, maxlength, initialText = "", pokemon = nil, nofadeout = false) ⇒ Object
1621
1622
1623
|
# File 'scripts/TextEntry.rb', line 1621
def pbEnterPokemonName(helptext,minlength,maxlength,initialText="",pokemon=nil,nofadeout=false)
return pbEnterText(helptext,minlength,maxlength,initialText,2,pokemon,nofadeout)
end
|
#pbEnterText(helptext, minlength, maxlength, initialText = "", mode = 0, pokemon = nil, nofadeout = false) ⇒ Object
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
|
# File 'scripts/TextEntry.rb', line 1599
def pbEnterText(helptext,minlength,maxlength,initialText="",mode=0,pokemon=nil,nofadeout=false)
ret=""
if USEKEYBOARDTEXTENTRY
pbFadeOutIn(99999,nofadeout){
sscene=PokemonEntryScene.new
sscreen=PokemonEntry.new(sscene)
ret=sscreen.pbStartScreen(helptext,minlength,maxlength,initialText,mode,pokemon)
}
else
pbFadeOutIn(99999,nofadeout){
sscene=PokemonEntryScene2.new
sscreen=PokemonEntry.new(sscene)
ret=sscreen.pbStartScreen(helptext,minlength,maxlength,initialText,mode,pokemon)
}
end
return ret
end
|
#pbEntireSlide(canvas) ⇒ Object
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
|
# File 'scripts/BattleAnimationEditor.rb', line 2666
def pbEntireSlide(canvas)
sliderwin2=ControlWindow.new(0,0,320,32*7)
sliderwin2.viewport=canvas.viewport
sliderwin2.addSlider(_INTL("First Frame:"),1,canvas.animation.length,1)
sliderwin2.addSlider(_INTL("Last Frame:"),1,canvas.animation.length,canvas.animation.length)
sliderwin2.addSlider(_INTL("X-Axis Movement"),-500,500,0)
sliderwin2.addSlider(_INTL("Y-Axis Movement"),-500,500,0)
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
sliderwin2.opacity=200
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
startvalue=sliderwin2.value(0)-1
endvalue=sliderwin2.value(1)-1
xoffset=sliderwin2.value(2)
yoffset=sliderwin2.value(3)
for i in startvalue..endvalue
canvas.offsetFrame(i,xoffset,yoffset)
end
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
return
end
|
#pbEntryScreen(*arg) ⇒ Object
764
765
766
767
768
769
770
771
772
773
774
775
776
|
# File 'scripts/PBattle_OrgBattle.rb', line 764
def pbEntryScreen(*arg)
retval=false
pbFadeOutIn(99999){
scene=PokemonScreen_Scene.new
screen=PokemonScreen.new(scene,$Trainer.party)
ret=screen.pbPokemonMultipleEntryScreenEx(pbBattleChallenge.rules.ruleset)
pbBattleChallenge.setParty(ret) if ret
retval=(ret!=nil && ret.length>0)
}
return retval
end
|
#pbEraseEscapePoint ⇒ Object
1866
1867
1868
|
# File 'scripts/PField_Field.rb', line 1866
def pbEraseEscapePoint
$PokemonGlobal.escapePoint=[]
end
|
#pbEventCanReachPlayer?(event, player, distance) ⇒ Boolean
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
|
# File 'scripts/PField_Field.rb', line 2206
def pbEventCanReachPlayer?(event,player,distance)
return false if distance<=0
return false if event.x!=player.x && event.y!=player.y
deltaX = (event.direction == 6 ? 1 : event.direction == 4 ? -1 : 0)
deltaY = (event.direction == 2 ? 1 : event.direction == 8 ? -1 : 0)
curx=event.x
cury=event.y
found=false
realdist=0
for i in 0...distance
curx+=deltaX
cury+=deltaY
if player.x==curx && player.y==cury
found=true
break
end
realdist+=1
end
return false if !found
curx=event.x
cury=event.y
for i in 0...realdist
if !event.passable?(curx,cury,event.direction)
return false
end
curx+=deltaX
cury+=deltaY
end
return true
end
|
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
# File 'scripts/Messages.rb', line 198
def (*args)
parameters = []
list = *args[0].list elements = *args[1] trigger = *args[2] return nil if list == nil
return nil unless list.is_a?(Array)
for item in list
next unless item.code == 108 || item.code == 408
if item.parameters[0] == trigger
start = list.index(item) + 1
finish = start + elements
for id in start...finish
next if !list[id]
parameters.push(list[id].parameters[0])
end
return parameters
end
end
return nil
end
|
#pbEventFacesPlayer?(event, player, distance) ⇒ Boolean
Event locations, terrain tags
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
|
# File 'scripts/PField_Field.rb', line 2185
def pbEventFacesPlayer?(event,player,distance)
return false if distance<=0
return false if event.x!=player.x && event.y!=player.y
deltaX = (event.direction == 6 ? 1 : event.direction == 4 ? -1 : 0)
deltaY = (event.direction == 2 ? 1 : event.direction == 8 ? -1 : 0)
curx=event.x
cury=event.y
found=false
for i in 0...distance
curx+=deltaX
cury+=deltaY
if player.x==curx && player.y==cury
found=true
break
end
end
return found
end
|
#pbEventId(event) ⇒ Object
2851
2852
2853
2854
2855
2856
2857
2858
2859
|
# File 'scripts/Compiler.rb', line 2851
def pbEventId(event)
list=event.pages[0].list
return nil if list.length==0
codes=[]
i=0;while i<list.length
codes.push(list[i].code)
i+=1
end
end
|
#pbEventIsEmpty?(e) ⇒ Boolean
3334
3335
3336
3337
3338
|
# File 'scripts/Compiler.rb', line 3334
def pbEventIsEmpty?(e)
return true if !e
return false if e.is_a?(RPG::CommonEvent)
return e.pages.length==0
end
|
#pbEventScreen(cls) ⇒ Object
714
715
716
717
718
719
720
721
722
723
|
# File 'scripts/EventScene.rb', line 714
def pbEventScreen(cls)
pbFadeOutIn(99999){
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
PBDebug.logonerr {
cls.new(viewport).main
}
viewport.dispose
}
end
|
#pbEvoDebug ⇒ Object
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'scripts/Pokemon_Evolution.rb', line 123
def pbEvoDebug()
_EVOTYPEMASK=0x3F
_EVODATAMASK=0xC0
pbRgssOpen("Data/evolutions.dat","rb"){|f|
for species in 1..PBSpecies.maxValue
f.pos=(species-1)*8
offset=f.fgetdw
length=f.fgetdw
puts PBSpecies.getName(species)
if length>0
f.pos=offset
i=0; loop do break unless i<length
evo=f.fgetb
evonib=evo&_EVOTYPEMASK
level=f.fgetw
poke=f.fgetw
puts sprintf("type=%02X, data=%02X, name=%s, level=%d",
evonib,evo&_EVODATAMASK,PBSpecies.getName(poke),level)
if poke==0
p f.eof?
break
end
i+=5
end
end
end
}
end
|
#pbEvolutionCheck(currentlevels) ⇒ Object
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
|
# File 'scripts/PField_Field.rb', line 1033
def pbEvolutionCheck(currentlevels)
for i in 0...currentlevels.length
pokemon=$Trainer.party[i]
if pokemon && (!currentlevels[i] || pokemon.level!=currentlevels[i]) &&
!(pokemon.species==83)
newspecies=Kernel.pbCheckEvolution(pokemon)
if newspecies>0
evo=PokemonEvolutionScene.new
evo.pbStartScreen(pokemon,newspecies)
evo.pbEvolution
evo.pbEndScreen
end
elsif pokemon && pokemon.species==83
newspecies=Kernel.pbCheckEvolution(pokemon)
if newspecies>0
evo=PokemonEvolutionScene.new
evo.pbStartScreen(pokemon,newspecies)
evo.pbEvolution
evo.pbEndScreen
end
end
end
end
|
#pbExportAnim(animations) ⇒ Object
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
|
# File 'scripts/BattleAnimationEditor.rb', line 2907
def pbExportAnim(animations)
filename=Kernel.pbMessageFreeText(_INTL("Enter a filename."),"",false,32)
if filename!=""
begin
filename+=".anm"
File.open(filename,"wb"){|f|
f.write(dumpBase64Anim(animations[animations.selected]))
}
failed=false
rescue
Kernel.pbMessage(_INTL("Couldn't save the animation to {1}.",filename))
failed=true
end
if !failed
Kernel.pbMessage(_INTL("Animation was saved to {1} in the game folder.",filename))
Kernel.pbMessage(_INTL("It's a text file, so it can be transferred to others easily."))
end
end
end
|
Extracción de los tipos de entrenadores al archivo PBS, compilación de los tipos de entrenadores y entrenadores individuales
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
|
# File 'scripts/Compiler.rb', line 2095
def
trainertypes=nil
pbRgssOpen("Data/trainertypes.dat","rb"){|f|
trainertypes=Marshal.load(f)
}
return if !trainertypes
File.open("trainertypes.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 0...trainertypes.length
next if !trainertypes[i]
record=trainertypes[i]
begin
cnst=getConstantName(PBTrainers,record[0])
rescue
next
end
f.write(sprintf("%d,%s,%s,%d,%s,%s,%s,%s,%d,%s\r\n",
record[0],csvquote(cnst),csvquote(record[2]),
record[3],csvquote(record[4]),csvquote(record[5]),csvquote(record[6]),
record[7] ? ["Male","Female","Mixed"][record[7]] : "Mixed",
record[8],record[9]
))
end
}
end
|
#pbFacingEachOther(event1, event2) ⇒ Object
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
|
# File 'scripts/PField_Field.rb', line 2267
def pbFacingEachOther(event1,event2)
return false if !event1 || !event2
if $MapFactory
tile1=$MapFactory.getFacingTile(nil,event1)
tile2=$MapFactory.getFacingTile(nil,event2)
return false if !tile1 || !tile2
if tile1[0]==event2.map.map_id &&
tile1[1]==event2.x && tile1[2]==event2.y &&
tile2[0]==event1.map.map_id &&
tile2[1]==event1.x && tile2[2]==event1.y
return true
else
return false
end
else
tile1=Kernel.pbFacingTile(nil,event1)
tile2=Kernel.pbFacingTile(nil,event2)
return false if !tile1 || !tile2
if tile1[1]==event2.x && tile1[2]==event2.y &&
tile2[1]==event1.x && tile2[2]==event1.y
return true
else
return false
end
end
end
|
#pbFacingTile(direction = nil, event = nil) ⇒ Object
2259
2260
2261
2262
2263
2264
2265
|
# File 'scripts/PField_Field.rb', line 2259
def pbFacingTile(direction=nil,event=nil)
if $MapFactory
return $MapFactory.getFacingTile(direction,event)
else
return pbFacingTileRegular(direction,event)
end
end
|
#pbFacingTileRegular(direction = nil, event = nil) ⇒ Object
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
|
# File 'scripts/PField_Field.rb', line 2240
def pbFacingTileRegular(direction=nil,event=nil)
event=$game_player if !event
return [0,0,0] if !event
x=event.x
y=event.y
direction=event.direction if !direction
case direction
when 1; y+=1; x-=1
when 2; y+=1
when 3; y+=1; x+=1
when 4; x-=1
when 6; x+=1
when 7; y-=1; x-=1
when 8; y-=1
when 9; y-=1; x+=1
end
return [$game_map ? $game_map.map_id : 0,x,y]
end
|
#pbFadeInAndShow(sprites, visiblesprites = nil) ⇒ Object
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
|
# File 'scripts/SpriteWindow.rb', line 1279
def pbFadeInAndShow(sprites,visiblesprites=nil)
if visiblesprites
for i in visiblesprites
if i[1] && sprites[i[0]] && !pbDisposed?(sprites[i[0]])
sprites[i[0]].visible=true
end
end
end
pbDeactivateWindows(sprites){
for j in 0..17
pbSetSpritesToColor(sprites,Color.new(0,0,0,((17-j)*15)))
block_given? ? yield : pbUpdateSpriteHash(sprites)
end
}
end
|
#pbFadeOutAndHide(sprites) ⇒ Object
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
|
# File 'scripts/SpriteWindow.rb', line 1262
def pbFadeOutAndHide(sprites)
visiblesprites={}
pbDeactivateWindows(sprites){
for j in 0..17
pbSetSpritesToColor(sprites,Color.new(0,0,0,j*15))
block_given? ? yield : pbUpdateSpriteHash(sprites)
end
}
for i in sprites
next if !i[1]
next if pbDisposed?(i[1])
visiblesprites[i[0]]=true if i[1].visible
i[1].visible=false
end
return visiblesprites
end
|
#pbFadeOutIn(z, nofadeout = false) ⇒ Object
pbFadeOutIn(z) { block } Fades out the screen before a block is run and fades it back in after the block exits. z indicates the z-coordinate of the viewport used for this effect
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
|
# File 'scripts/SpriteWindow.rb', line 1235
def pbFadeOutIn(z,nofadeout=false)
col=Color.new(0,0,0,0)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=z
for j in 0..17
col.set(0,0,0,j*15)
viewport.color=col
Graphics.update
Input.update
end
pbPushFade
begin
yield if block_given?
ensure
pbPopFade
if !nofadeout
for j in 0..17
col.set(0,0,0,(17-j)*15)
viewport.color=col
Graphics.update
Input.update
end
end
viewport.dispose
end
end
|
#pbFancyCupRules(double) ⇒ Object
#pbFancyMoveTo(follower, newX, newY) ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'scripts/PField_DependentEvents.rb', line 128
def pbFancyMoveTo(follower,newX,newY)
if follower.x-newX==-1 && follower.y==newY
moveFancy(follower,6)
elsif follower.x-newX==1 && follower.y==newY
moveFancy(follower,4)
elsif follower.y-newY==-1 && follower.x==newX
moveFancy(follower,2)
elsif follower.y-newY==1 && follower.x==newX
moveFancy(follower,8)
elsif follower.x-newX==-2 && follower.y==newY
jumpFancy(follower,6)
elsif follower.x-newX==2 && follower.y==newY
jumpFancy(follower,4)
elsif follower.y-newY==-2 && follower.x==newX
jumpFancy(follower,2)
elsif follower.y-newY==2 && follower.x==newX
jumpFancy(follower,8)
elsif follower.x!=newX || follower.y!=newY
follower.moveto(newX,newY)
end
end
|
#pbFastInspect(pkmn, moves, species, items, natures) ⇒ Object
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
|
# File 'scripts/Editor.rb', line 914
def pbFastInspect(pkmn,moves,species,items,natures)
c1=species[pkmn.species] ? species[pkmn.species] :
(species[pkmn.species]=(getConstantName(PBSpecies,pkmn.species) rescue pbGetSpeciesConst(pkmn.species)))
c2=items[pkmn.item] ? items[pkmn.item] :
(items[pkmn.item]=(getConstantName(PBItems,pkmn.item) rescue pbGetItemConst(pkmn.item)))
c3=natures[pkmn.nature] ? natures[pkmn.nature] :
(natures[pkmn.nature]=getConstantName(PBNatures,pkmn.nature))
evlist=""
ev=pkmn.ev
evs=["HP","ATK","DEF","SPD","SA","SD"]
for i in 0...ev
if ((ev&(1<<i))!=0)
evlist+="," if evlist.length>0
evlist+=evs[i]
end
end
c4=moves[pkmn.move1] ? moves[pkmn.move1] :
(moves[pkmn.move1]=(getConstantName(PBMoves,pkmn.move1) rescue pbGetMoveConst(pkmn.move1)))
c5=moves[pkmn.move2] ? moves[pkmn.move2] :
(moves[pkmn.move2]=(getConstantName(PBMoves,pkmn.move2) rescue pbGetMoveConst(pkmn.move2)))
c6=moves[pkmn.move3] ? moves[pkmn.move3] :
(moves[pkmn.move3]=(getConstantName(PBMoves,pkmn.move3) rescue pbGetMoveConst(pkmn.move3)))
c7=moves[pkmn.move4] ? moves[pkmn.move4] :
(moves[pkmn.move4]=(getConstantName(PBMoves,pkmn.move4) rescue pbGetMoveConst(pkmn.move4)))
return "#{c1};#{c2};#{c3};#{evlist};#{c4},#{c5},#{c6},#{c7}"
end
|
#pbFindEncounter(encounter, species) ⇒ Object
1
2
3
4
5
6
7
8
9
10
|
# File 'scripts/PScreen_PokedexNestForm.rb', line 1
def pbFindEncounter(encounter,species)
return false if !encounter
for i in 0...encounter.length
next if !encounter[i]
for j in 0...encounter[i].length
return true if encounter[i][j][0]==species
end
end
return false
end
|
#pbFindPhoneTrainer(trtype, trname) ⇒ Object
Ignores whether visible or not
23
24
25
26
27
28
29
30
31
|
# File 'scripts/PScreen_Phone.rb', line 23
def pbFindPhoneTrainer(trtype,trname) return nil if !$PokemonGlobal.phoneNumbers
for num in $PokemonGlobal.phoneNumbers
if num[1]==trtype && num[2]==trname return num
end
end
return nil
end
|
#pbFindScript(a, name) ⇒ Object
Constantes definidas en un script
776
777
778
779
780
781
782
|
# File 'scripts/Compiler.rb', line 776
def pbFindScript(a,name)
a.each{|i|
next if !i
return i if i[1]==name
}
return nil
end
|
#pbFishing(hasencounter, rodtype = 1) ⇒ Object
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
|
# File 'scripts/PField_Field.rb', line 1536
def pbFishing(hasencounter,rodtype=1)
speedup=($Trainer.firstParty && !$Trainer.firstParty.isEgg? &&
(isConst?($Trainer.firstParty.ability,PBAbilities,:STICKYHOLD) ||
isConst?($Trainer.firstParty.ability,PBAbilities,:SUCTIONCUPS)))
bitechance=20+(25*rodtype) bitechance*=1.5 if speedup
hookchance=100
oldpattern=$game_player.fullPattern
pbFishingBegin
msgwindow=Kernel.pbCreateMessageWindow
loop do
time=2+rand(10)
time=[time,2+rand(10)].min if speedup
message=""
time.times do
message+=". "
end
if pbWaitMessage(msgwindow,time)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
Kernel.pbMessageDisplay(msgwindow,_INTL("Hoy no pican..."))
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
if rand(100)<bitechance && hasencounter
frames=rand(21)+20
if !pbWaitForInput(msgwindow,message+_INTL("\r\n¡Oh! ¡Han picado!"),frames)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
Kernel.pbMessageDisplay(msgwindow,_INTL("El Pokémon ha escapado..."))
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
if rand(100)<hookchance || FISHINGAUTOHOOK
Kernel.pbMessageDisplay(msgwindow,_INTL("¡Un Pokémon ha mordido el anzuelo!"))
Kernel.pbDisposeMessageWindow(msgwindow)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
return true
end
else
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
Kernel.pbMessageDisplay(msgwindow,_INTL("Hoy no pican..."))
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
end
Kernel.pbDisposeMessageWindow(msgwindow)
return false
end
|
#pbFishingBegin ⇒ Object
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
|
# File 'scripts/PField_Field.rb', line 1494
def pbFishingBegin
$PokemonGlobal.fishing=true
if !pbCommonEvent(FISHINGBEGINCOMMONEVENT)
patternb = 2*$game_player.direction - 1
playertrainer=pbGetPlayerTrainerType
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
num=($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!=""
charset=pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb-pattern)
2.times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
end
|
#pbFishingEnd ⇒ Object
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
|
# File 'scripts/PField_Field.rb', line 1515
def pbFishingEnd
if !pbCommonEvent(FISHINGENDCOMMONEVENT)
patternb = 2*($game_player.direction - 2)
playertrainer=pbGetPlayerTrainerType
meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
num=($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!=""
charset=pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb+pattern)
2.times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
$PokemonGlobal.fishing=false
end
|
#pbFixEventUse(event, mapID, mapdata) ⇒ Object
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
|
# File 'scripts/Compiler.rb', line 3368
def pbFixEventUse(event,mapID,mapdata)
return nil if pbEventIsEmpty?(event)
changed=false
trainerMoneyRE=/^\s*\$Trainer\.money\s*(<|<=|>|>=)\s*(\d+)\s*$/
itemBallRE=/^\s*(Kernel\.)?pbItemBall/
if pbUpdateDoor(event,mapdata)
changed=true
end
pbEachPage(event) do |page|
i=0
list=page.list
while i<list.length
params=list[i].parameters
if list[i].code==655
x=[params[0]]
changed|=pbChangeScripts(x)
params[0]=x[0]
elsif list[i].code==355
lastScript=i
if !params[0].is_a?(String)
i+=1
next
end
x=[params[0]]
changed|=pbChangeScripts(x)
params[0]=x[0]
if params[0][0,1]!="f" && params[0][0,1]!="p" && params[0][0,1]!="K"
i+=1
next
end
script=" "+params[0]
j=i+1
while j<list.length
break if list[j].code!=655
script+=list[j].parameters[0]
lastScript=j
j+=1
end
script.gsub!(/\s+/,"")
if script=="foriin$Trainer.partyi.healend"
for j in i..lastScript
list.delete_at(i)
end
list.insert(i,
RPG::EventCommand.new(314,list[i].indent,[0]) )
changed=true
elsif script=="pbFadeOutIn(99999){foriin$Trainer.partyi.healend}"
oldIndent=list[i].indent
for j in i..lastScript
list.delete_at(i)
end
list.insert(i,
RPG::EventCommand.new(223,oldIndent,[Tone.new(-255,-255,-255),6]), RPG::EventCommand.new(106,oldIndent,[6]), RPG::EventCommand.new(314,oldIndent,[0]), RPG::EventCommand.new(223,oldIndent,[Tone.new(0,0,0),6]), RPG::EventCommand.new(106,oldIndent,[6]) )
changed=true
end
elsif list[i].code==108
if params[0][/SellItem\s*\(\s*(\w+)\s*\,\s*(\d+)\s*\)/]
itemname=$1
cost=$2.to_i
if hasConst?(PBItems,itemname)
oldIndent=list[i].indent
list.delete_at(i)
newEvents=[]
if cost==0
pbPushBranch(newEvents,"$PokemonBag.pbCanStore?(PBItems:"+":#{itemname})",oldIndent)
pbPushText(newEvents,_INTL("¡Aquí tienes!"),oldIndent+1)
pbPushScript(newEvents,"Kernel.pbReceiveItem(PBItems:"+":#{itemname})",oldIndent+1)
pbPushElse(newEvents,oldIndent+1)
pbPushText(newEvents,_INTL("No tienes más espacio en la Mochila."),oldIndent+1)
pbPushBranchEnd(newEvents,oldIndent+1)
else
pbPushEvent(newEvents,111,[7,cost,0],oldIndent)
pbPushBranch(newEvents,"$PokemonBag.pbCanStore?(PBItems:"+":#{itemname})",oldIndent+1)
pbPushEvent(newEvents,125,[1,0,cost],oldIndent+2)
pbPushText(newEvents,_INTL("\\G¡Aquí tienes!"),oldIndent+2)
pbPushScript(newEvents,"Kernel.pbReceiveItem(PBItems:"+":#{itemname})",oldIndent+2)
pbPushElse(newEvents,oldIndent+2)
pbPushText(newEvents,_INTL("\\GNo tienes más espacio en la Mochila."),oldIndent+2)
pbPushBranchEnd(newEvents,oldIndent+2)
pbPushElse(newEvents,oldIndent+1)
pbPushText(newEvents,_INTL("\\GNo tienes el dinero suficiente."),oldIndent+1)
pbPushBranchEnd(newEvents,oldIndent+1)
end
list[i,0]=newEvents changed=true
end
end
elsif list[i].code==115 && i==list.length-2
list.delete_at(i)
changed=true
elsif list[i].code==201 && list.length<=8
if params[0]==0
e=mapdata.getEventFromXY(params[1],params[2],params[3]-1)
if e && e.pages.length>=2 &&
e.pages[e.pages.length-1].condition.switch1_valid &&
e.pages[e.pages.length-1].condition.switch1_id==22 &&
mapdata.switchName(e.pages[e.pages.length-1].condition.switch1_id)!='s:tsOff?("A")' &&
e.pages[e.pages.length-1].list.length>5 &&
e.pages[e.pages.length-1].list[0].code==111
e.pages[e.pages.length-1].condition.switch1_id=mapdata.registerSwitch('s:tsOff?("A")')
mapdata.saveMap(params[1])
changed=true
end
if isLikelyPassage?(e,params[1],mapdata)
pbAddPassageList(e,mapdata)
mapdata.saveMap(params[1])
changed=true
end
if e && e.pages.length>=2 &&
e.pages[e.pages.length-1].condition.switch1_valid &&
mapdata.switchName(e.pages[e.pages.length-1].condition.switch1_id)=='s:tsOff?("A")'
params[3]-=1
params[5]=1 changed=true
end
deletedRoute=nil
deleteMoveRouteAt=proc{|list,_i|
arr=[]
if list[_i] && list[_i].code==209
arr.push(list[_i]);list.delete_at(_i)
while _i<list.length
break if !list[_i] || list[_i].code!=509
arr.push(list[_i]);list.delete_at(_i)
end
end
next arr
}
insertMoveRouteAt=proc{|list,_i,route|
_j=route.length-1
while _j>=0
list.insert(_i,route[_j])
_j-=1
end
}
if params[4]==0 && i+1<list.length && list[i+1].code==209 && list[i+1].parameters[0]==-1
route=list[i+1].parameters[1]
if route && route.list.length<=2
if route.list[0].code==16 deleteMoveRouteAt.call(list,i+1); params[4]=2; changed=true
elsif route.list[0].code==17 deleteMoveRouteAt.call(list,i+1); params[4]=4; changed=true
elsif route.list[0].code==18 deleteMoveRouteAt.call(list,i+1); params[4]=6; changed=true
elsif route.list[0].code==19 deleteMoveRouteAt.call(list,i+1); params[4]=8; changed=true
elsif (route.list[0].code==1 || route.list[0].code==2 ||
route.list[0].code==3 || route.list[0].code==4) && list.length==4
params[4]=[0,2,4,6,8][route.list[0].code]
deletedRoute=deleteMoveRouteAt.call(list,i+1); changed=true
end
end
elsif params[4]==0 && i>3
for j in 0...i
if list[j].code==209 && list[j].parameters[0]==-1
route=list[j].parameters[1]
oldlistlength=list.length
if route && route.list.length<=2
if route.list[0].code==16 deleteMoveRouteAt.call(list,j); params[4]=2; changed=true;i-=(oldlistlength-list.length)
elsif route.list[0].code==17 deleteMoveRouteAt.call(list,j); params[4]=4; changed=true;i-=(oldlistlength-list.length)
elsif route.list[0].code==18 deleteMoveRouteAt.call(list,j); params[4]=6; changed=true;i-=(oldlistlength-list.length)
elsif route.list[0].code==19 deleteMoveRouteAt.call(list,j); params[4]=8; changed=true;i-=(oldlistlength-list.length)
end
end
end
end
elsif params[4]==0 && i+2<list.length &&
list[i+1].code==223 &&
list[i+2].code==209 &&
list[i+2].parameters[0]==-1
route=list[i+2].parameters[1]
if route && route.list.length<=2
if route.list[0].code==16 deleteMoveRouteAt.call(list,i+2); params[4]=2; changed=true
elsif route.list[0].code==17 deleteMoveRouteAt.call(list,i+2); params[4]=4; changed=true
elsif route.list[0].code==18 deleteMoveRouteAt.call(list,i+2); params[4]=6; changed=true
elsif route.list[0].code==19 deleteMoveRouteAt.call(list,i+2); params[4]=8; changed=true
end
end
end
end
if list.length==2 || (list.length==3 && (list[0].code==250 || list[1].code==250))
params[5]=1 fullTransfer=list[i]
indent=list[i].indent
(list.length-1).times { list.delete_at(0) }
list.insert(0,
RPG::EventCommand.new(250,indent,[RPG::AudioFile.new("Exit Door",80,100)]), RPG::EventCommand.new(223,indent,[Tone.new(-255,-255,-255),6]), RPG::EventCommand.new(106,indent,[8]), fullTransfer, RPG::EventCommand.new(223,indent,[Tone.new(0,0,0),6]) )
changed=true
end
if deletedRoute
insertMoveRouteAt.call(list,list.length-1,deletedRoute)
changed=true
end
elsif list[i].code==101
if list[i].parameters[0][0,1]=="\\"
newx=list[i].parameters[0].clone
newx.sub!(/^\\[Bb]\s+/,"\\b")
newx.sub!(/^\\[Rr]\s+/,"\\r")
newx.sub!(/^\\[Pp][Gg]\s+/,"\\pg")
newx.sub!(/^\\[Pp][Oo][Gg]\s+/,"\\pog")
newx.sub!(/^\\[Gg]\s+/,"\\G")
newx.sub!(/^\\[Cc][Nn]\s+/,"\\CN")
if list[i].parameters[0]!=newx
list[i].parameters[0]=newx
changed=true
end
end
lines=1
j=i+1; while j<list.length
break if list[j].code!=401
if lines%4==0
list[j].code=101
changed=true
end
lines+=1
j+=1
end
if lines>=2 && list[i].parameters[0].length>0 && list[i].parameters[0].length<=20 &&
!list[i].parameters[0][/\\n/]
list[i].parameters[0]+="\\n"+list[i+1].parameters[0]
list.delete_at(i+1)
i-=1 changed=true
elsif lines>=3 && list[i+lines] && list[i+lines].code==101
lastLine=list[i+lines-1].parameters[0].sub(/\s+$/,"")
if lastLine.length>0 && !lastLine[/[\\<]/] && lastLine[/[^\.,\!\?\;\-\"]$/]
message=list[i].parameters[0]
j=i+1; while j<list.length
break if list[j].code!=401
message+="\n"+list[j].parameters[0]
j+=1
end
punct=[message.rindex(". "),message.rindex(".\n"),
message.rindex("!"),message.rindex("?"),-1].compact.max
if punct==-1
punct=[message.rindex(", "),message.rindex(",\n"),-1].compact.max
end
if punct!=-1
indent=list[i].indent
newMessage=message[0,punct+1].split("\n")
nextMessage=message[punct+1,message.length].sub(/^\s+/,"").split("\n")
list[i+lines].code=401
lines.times { list.delete_at(i) }
j=nextMessage.length-1;while j>=0
list.insert(i,RPG::EventCommand.new(
j==0 ? 101 : 401,indent,[nextMessage[j]]))
j-=1
end
j=newMessage.length-1;while j>=0
list.insert(i,RPG::EventCommand.new(
j==0 ? 101 : 401,indent,[newMessage[j]]))
j-=1
end
changed=true
i+=1
next
end
end
end
elsif list[i].code==111 && list[i].parameters[0]==12
x=[list[i].parameters[1]]
changed|=pbChangeScripts(x)
list[i].parameters[1]=x[0]
script=x[0]
if script[trainerMoneyRE]
operator=$1
amount=$2.to_i
params[0]=7
if operator=="<"
params[2]=1
params[1]=amount-1
elsif operator=="<="
params[2]=1
params[1]=amount
elsif operator==">"
params[2]=0
params[1]=amount+1
elsif operator==">="
params[2]=0
params[1]=amount
end
changed=true
elsif script[itemBallRE] && i>0
list[i].parameters[1]=script.sub(/pbItemBall/,"pbReceiveItem")
changed=true
elsif script[/^\s*(Kernel\.)?(pbTrainerBattle|pbDoubleTrainerBattle)/]
j=i+1
isempty=true
elseIndex=-1
while j<page.list.length
if list[j].indent<=list[i].indent
if list[j].code==411 elseIndex=j
else
break
end
end
if list[j].code!=0 && list[j].code!=411
isempty=false
break
end
j+=1
end
if isempty
if elseIndex>=0
list.insert(elseIndex+1,
RPG::EventCommand.new(115,list[i].indent+1,[]) )
else
list.insert(i+1,
RPG::EventCommand.new(0,list[i].indent+1,[]), RPG::EventCommand.new(411,list[i].indent,[]), RPG::EventCommand.new(115,list[i].indent+1,[]) )
end
changed=true
end
end
end
i+=1
end
end
return changed ? event : nil
end
|
#pbFlash(color, frames) ⇒ Object
2498
2499
2500
|
# File 'scripts/PField_Field.rb', line 2498
def pbFlash(color,frames)
$game_screen.start_flash(color,frames * 2)
end
|
#pbForgetMove(pokemon, moveToLearn) ⇒ Object
512
513
514
515
516
517
518
519
520
|
# File 'scripts/PItem_Items.rb', line 512
def pbForgetMove(pokemon,moveToLearn)
ret=-1
pbFadeOutIn(99999){
scene=PokemonSummaryScene.new
screen=PokemonSummary.new(scene)
ret=screen.pbStartForgetScreen([pokemon],0,moveToLearn)
}
return ret
end
|
#pbGenerateBattleTrainer(trainerid, rule) ⇒ Object
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
|
# File 'scripts/PBattle_OrgBattle.rb', line 933
def pbGenerateBattleTrainer(trainerid,rule)
bttrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
trainerdata=bttrainers[trainerid]
opponent=PokeBattle_Trainer.new(
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
trainerdata[0])
btpokemon=pbGetBTPokemon(pbBattleChallenge.currentChallenge)
indvalues=31
indvalues=21 if trainerid<220
indvalues=18 if trainerid<200
indvalues=15 if trainerid<180
indvalues=12 if trainerid<160
indvalues=9 if trainerid<140
indvalues=6 if trainerid<120
indvalues=3 if trainerid<100
pokemonnumbers=trainerdata[5]
if pokemonnumbers.length<rule.ruleset.suggestedNumber
for n in pokemonnumbers
rndpoke=btpokemon[n]
pkmn=rndpoke.createPokemon(
rule.ruleset.suggestedLevel,indvalues,opponent)
opponent.party.push(pkmn)
end
return opponent
end
begin
opponent.party.clear
while opponent.party.length<rule.ruleset.suggestedNumber
rnd=pokemonnumbers[rand(pokemonnumbers.length)]
rndpoke=btpokemon[rnd]
pkmn=rndpoke.createPokemon(
rule.ruleset.suggestedLevel,indvalues,opponent)
opponent.party.push(pkmn)
end
end until rule.ruleset.isValid?(opponent.party)
return opponent
end
|
#pbGenerateChallenge(rule, tag) {|_INTL("Preparándose para generar equipos")| ... } ⇒ Object
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1317
def pbGenerateChallenge(rule,tag)
oldrule=rule
yield(_INTL("Preparándose para generar equipos"))
rule=rule.copy.setNumber(2)
yield(nil)
party=load_data(tag+".rxdata") rescue []
teams=load_data(tag+"teams.rxdata") rescue []
if teams.length<10
btpokemon=pbGetBTPokemon(tag)
if btpokemon && btpokemon.length!=0
suggestedLevel=rule.ruleset.suggestedLevel
for pk in btpokemon
pkmn=pk.createPokemon(suggestedLevel,31,nil)
party.push(pkmn) if rule.ruleset.isPokemonValid?(pkmn)
end
end
end
yield(nil)
party=pbRemoveDuplicates(party)
yield(nil)
maxteams=600
cutoffrating=65
toolowrating=40
iterations=11
iterations.times do |iter|
save_data(party,tag+".rxdata")
yield(_INTL("Generando equipos ({1} de {2})",iter+1,iterations))
i=0;while i<teams.length
yield(nil) if i%10==0
pbReplenishBattlePokemon(party,rule)
if teams[i].rating<cutoffrating && teams[i].totalGames>=80
teams[i]=RuledTeam.new(party,rule)
elsif teams[i].length<2
teams[i]=RuledTeam.new(party,rule)
elsif i>=maxteams
teams[i]=nil
teams.compact!
elsif teams[i].totalGames>=250
for j in 0...teams[i].length
party.push(teams[i][j])
end
teams[i]=RuledTeam.new(party,rule)
elsif teams[i].rating<toolowrating
teams[i]=RuledTeam.new(party,rule)
end
i+=1
end
save_data(teams,tag+"teams.rxdata")
yield(nil)
while teams.length<maxteams
yield(nil) if teams.length%10==0
pbReplenishBattlePokemon(party,rule)
teams.push(RuledTeam.new(party,rule))
end
save_data(party,tag+".rxdata")
teams=teams.sort{|a,b| b.rating<=>a.rating }
yield(_INTL("Simulando batallas ({1} de {2})",iter+1,iterations))
i=0; loop do
changed=false
teams.length.times {|j|
yield(nil)
other=j;5.times do
other=rand(teams.length)
next if other==j
end
next if other==j
changed=true
pbRuledBattle(teams[j],teams[other],rule)
}
i+=1
gameCount=0
for team in teams
gameCount+=team.games
end
yield(nil)
if (gameCount/teams.length)>=12
for team in teams
games=team.games
team.updateRating
end
break
end
end
teams.sort!{|a,b| b.rating<=>a.rating }
save_data(teams,tag+"teams.rxdata")
end
party=[]
yield(nil)
teams.sort{|a,b| a.rating<=>b.rating }
for team in teams
if team.rating>cutoffrating
for i in 0...team.length
party.push(team[i])
end
end
end
rule=oldrule
yield(nil)
party=pbRemoveDuplicates(party)
yield(_INTL("Escribiendo resultados"))
party=pbArrangeByTier(party,rule)
yield(nil)
pbTrainerInfo(party,tag,rule) { yield(nil) }
yield(nil)
end
|
#pbGenerateMoveRoute(commands) ⇒ Object
Generación y modificación de los eventos
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
|
# File 'scripts/Compiler.rb', line 2714
def pbGenerateMoveRoute(commands)
route=RPG::MoveRoute.new
route.repeat=false
route.skippable=true
route.list.clear
i=0; while i<commands.length
case commands[i]
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1]]))
i+=1
when PBMoveRoute::ScriptAsync
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script,[commands[i+1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait,[0]))
i+=1
when PBMoveRoute::Jump
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1],commands[i+2]]))
i+=2
when PBMoveRoute::Graphic
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1],commands[i+2],commands[i+3],commands[i+4]]))
i+=4
else
route.list.push(RPG::MoveCommand.new(commands[i]))
end
i+=1
end
route.list.push(RPG::MoveCommand.new(0))
return route
end
|
#pbGenerateWildPokemon(species, level, isroamer = false) ⇒ Object
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
|
# File 'scripts/PField_Field.rb', line 832
def pbGenerateWildPokemon(species,level,isroamer=false)
genwildpoke=PokeBattle_Pokemon.new(species,level,$Trainer)
items=genwildpoke.wildHoldItems
firstpoke=$Trainer.firstParty
chances=[50,5,1]
chances=[60,20,5] if firstpoke && !firstpoke.isEgg? &&
isConst?(firstpoke.ability,PBAbilities,:COMPOUNDEYES)
itemrnd=rand(100)
if itemrnd<chances[0] || (items[0]==items[1] && items[1]==items[2])
genwildpoke.setItem(items[0])
elsif itemrnd<(chances[0]+chances[1])
genwildpoke.setItem(items[1])
elsif itemrnd<(chances[0]+chances[1]+chances[2])
genwildpoke.setItem(items[2])
end
if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbQuantity(:SHINYCHARM)>0
for i in 0...2 break if genwildpoke.isShiny?
genwildpoke.personalID=rand(65536)|(rand(65536)<<16)
end
end
if rand(65536)<POKERUSCHANCE
genwildpoke.givePokerus
end
if firstpoke && !firstpoke.isEgg?
if isConst?(firstpoke.ability,PBAbilities,:CUTECHARM) &&
!genwildpoke.isSingleGendered?
if firstpoke.isMale?
(rand(3)<2) ? genwildpoke.makeFemale : genwildpoke.makeMale
elsif firstpoke.isFemale?
(rand(3)<2) ? genwildpoke.makeMale : genwildpoke.makeFemale
end
elsif isConst?(firstpoke.ability,PBAbilities,:SYNCHRONIZE)
genwildpoke.setNature(firstpoke.nature) if !isroamer && rand(10)<5
end
end
Events.onWildPokemonCreate.trigger(nil,genwildpoke)
return genwildpoke
end
|
#pbGetAbbrevMonthName(month) ⇒ Object
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# File 'scripts/PField_Time.rb', line 268
def pbGetAbbrevMonthName(month)
return ["",
_INTL("Ene."),
_INTL("Feb."),
_INTL("Mar."),
_INTL("Abr."),
_INTL("May"),
_INTL("Jun."),
_INTL("Jul."),
_INTL("Ago."),
_INTL("Sep."),
_INTL("Oct."),
_INTL("Nov."),
_INTL("Dic.")][month]
end
|
#pbGetAbilityConst(i) ⇒ Object
#pbGetAnimation(name, hue = 0) ⇒ Object
250
251
252
|
# File 'scripts/SpriteWindow.rb', line 250
def pbGetAnimation(name,hue=0)
return AnimatedBitmap.new("Graphics/Animations/"+name,hue).deanimate
end
|
#pbGetAutotile(name, hue = 0) ⇒ Object
258
259
260
|
# File 'scripts/SpriteWindow.rb', line 258
def pbGetAutotile(name,hue=0)
return AnimatedBitmap.new("Graphics/Autotiles/"+name,hue).deanimate
end
|
#pbGetBabySpecies(species, item1 = -1,, item2 = -1)) ⇒ Object
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
# File 'scripts/Pokemon_Evolution.rb', line 217
def pbGetBabySpecies(species,item1=-1,item2=-1)
ret=species
_EVOTYPEMASK=0x3F
_EVODATAMASK=0xC0
_EVOPREVFORM=0x40
pbRgssOpen("Data/evolutions.dat","rb"){|f|
f.pos=(species-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
evo=f.fgetb
evonib=evo&_EVOTYPEMASK
level=f.fgetw
poke=f.fgetw
if poke<=PBSpecies.maxValue && (evo&_EVODATAMASK)==_EVOPREVFORM if item1>=0 && item2>=0
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,poke,54)
incense=dexdata.fgetw
dexdata.close
ret=poke if item1==incense || item2==incense
else
ret=poke
end
break
end
i+=5
end
end
}
if ret!=species
ret=pbGetBabySpecies(ret)
end
return ret
end
|
#pbGetBallType(ball) ⇒ Object
42
43
44
45
46
47
48
|
# File 'scripts/PItem_PokeBalls.rb', line 42
def pbGetBallType(ball)
ball=getID(PBItems,ball)
for key in $BallTypes.keys
return key if isConst?(ball,PBItems,$BallTypes[key])
end
return 0
end
|
#pbGetBasicMapNameFromId(id) ⇒ Object
978
979
980
981
982
983
984
985
986
|
# File 'scripts/Messages.rb', line 978
def pbGetBasicMapNameFromId(id)
begin
map = pbLoadRxData("Data/MapInfos")
return "" if !map
return map[id].name
rescue
return ""
end
end
|
#pbGetBTPokemon(challengeID) ⇒ Object
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
# File 'scripts/PBattle_OrgBattle.rb', line 239
def pbGetBTPokemon(challengeID)
trlists=(load_data("Data/trainerlists.dat") rescue [])
for tr in trlists
if !tr[5] && tr[2].include?(challengeID)
return tr[1]
end
end
for tr in trlists
if tr[5] return tr[1]
end
end
return []
end
|
#pbGetBTTrainers(challengeID) ⇒ Object
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'scripts/PBattle_OrgBattle.rb', line 222
def pbGetBTTrainers(challengeID)
trlists=(load_data("Data/trainerlists.dat") rescue [])
for i in 0...trlists.length
tr=trlists[i]
if !tr[5] && tr[2].include?(challengeID)
return tr[0]
end
end
for i in 0...trlists.length
tr=trlists[i]
if tr[5] return tr[0]
end
end
return []
end
|
#pbGetColorConst(i) ⇒ Object
95
96
97
98
99
100
101
|
# File 'scripts/Editor.rb', line 95
def pbGetColorConst(i)
ret=["Red","Blue","Yellow","Green","Black",
"Brown","Purple","Gray","White","Pink"
]
i=0 if i>=ret.length || i<0
return ret[i]
end
|
#pbGetConst(mod, item, err) ⇒ Object
Enum const manipulators and parsers
699
700
701
702
703
704
705
706
707
708
|
# File 'scripts/Compiler.rb', line 699
def pbGetConst(mod,item,err)
isdef=false
begin
isdef=mod.const_defined?(item.to_sym)
rescue
raise sprintf(err,item)
end
raise sprintf(err,item) if !isdef
return mod.const_get(item.to_sym)
end
|
#pbGetCsvRecord(rec, lineno, schema) ⇒ Object
Lectura/escritura de registros csv
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
# File 'scripts/Compiler.rb', line 479
def pbGetCsvRecord(rec,lineno,schema)
record=[]
repeat=false
if schema[1][0,1]=="*"
repeat=true
start=1
else
repeat=false
start=0
end
begin
for i in start...schema[1].length
chr=schema[1][i,1]
case chr
when "u"
record.push(csvPosInt!(rec,lineno))
when "v"
field=csvPosInt!(rec,lineno)
raise _INTL("El campo '{1}' debe ser mayor que 0\r\n{2}",field,FileLineData.linereport) if field==0
record.push(field)
when "i"
record.push(csvInt!(rec,lineno))
when "U", "I"
field=csvfield!(rec)
if field==""
record.push(nil)
elsif !field[/^\d+$/]
raise _INTL("El campo '{1}' debe ser 0 o mayor\r\n{2}",field,FileLineData.linereport)
else
record.push(field.to_i)
end
when "x"
field=csvfield!(rec)
if !field[/^[A-Fa-f0-9]+$/]
raise _INTL("El campo '{1}' no es un número hexadecimal\r\n{2}",field,FileLineData.linereport)
end
record.push(field.hex)
when "s"
record.push(csvfield!(rec))
when "S"
field=csvfield!(rec)
if field==""
record.push(nil)
else
record.push(field)
end
when "n" field=csvfield!(rec)
if !field[/^(?![0-9])\w+$/]
raise _INTL("El campo '{1}' solo debe contener letras, números y\r\nguiones bajos, sin iniciar con un número.\r\n{2}",field,FileLineData.linereport)
end
record.push(field)
when "N" field=csvfield!(rec)
if field==""
record.push(nil)
else
if !field[/^(?![0-9])\w+$/]
raise _INTL("El campo '{1}' solo debe contener letras, números y\r\nguiones bajos, sin iniciar con un número.\r\n{2}",field,FileLineData.linereport)
end
record.push(field)
end
when "b"
record.push(csvBoolean!(rec,lineno))
when "e"
record.push(csvEnumField!(rec,schema[2+i-start],"",FileLineData.linereport))
end
end
break if repeat && rec==""
end while repeat
return (schema[1].length==1) ? record[0] : record
end
|
#pbGetDependency(eventName) ⇒ Object
Gets the Game_Character object associated with a dependent event.
30
31
32
|
# File 'scripts/PField_DependentEvents.rb', line 30
def pbGetDependency(eventName)
return $PokemonTemp.dependentEvents.getEventByName(eventName)
end
|
#pbGetEggGroupConst(i) ⇒ Object
85
86
87
88
89
90
91
92
93
|
# File 'scripts/Editor.rb', line 85
def pbGetEggGroupConst(i)
ret=["Undiscovered",
"Monster","Water1","Bug","Flying","Field",
"Fairy","Grass","Humanlike","Water3","Mineral",
"Amorphous","Water2","Ditto","Dragon","Undiscovered"
]
i=0 if i>=ret.length || i<0
return ret[i]
end
|
#pbGetEnvironment ⇒ Object
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
|
# File 'scripts/PField_Field.rb', line 808
def pbGetEnvironment
return PBEnvironment::None if !$game_map
if $PokemonGlobal && $PokemonGlobal.diving
return PBEnvironment::Underwater
elsif $PokemonEncounters && $PokemonEncounters.isCave?
return PBEnvironment::Cave
elsif !pbGetMetadata($game_map.map_id,MetadataOutdoor)
return PBEnvironment::None
else
case $game_player.terrain_tag
when PBTerrain::Grass; return PBEnvironment::Grass when PBTerrain::Sand; return PBEnvironment::Sand
when PBTerrain::Rock; return PBEnvironment::Rock
when PBTerrain::DeepWater; return PBEnvironment::MovingWater
when PBTerrain::StillWater; return PBEnvironment::StillWater
when PBTerrain::Water; return PBEnvironment::MovingWater
when PBTerrain::TallGrass; return PBEnvironment::TallGrass when PBTerrain::SootGrass; return PBEnvironment::Grass when PBTerrain::Puddle; return PBEnvironment::StillWater
end
end
return PBEnvironment::None
end
|
#pbGetEvolutionConst(i) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'scripts/Editor.rb', line 67
def pbGetEvolutionConst(i)
ret=["Unknown",
"Happiness","HappinessDay","HappinessNight","Level","Trade",
"TradeItem","Item","AttackGreater","AtkDefEqual","DefenseGreater",
"Silcoon","Cascoon","Ninjask","Shedinja","Beauty",
"ItemMale","ItemFemale","DayHoldItem","NightHoldItem","HasMove",
"HasInParty","LevelMale","LevelFemale","Location","TradeSpecies",
"LevelDay","LevelNight","LevelDarkInParty","LevelRain","HappinessMoveType",
"LevelForm0","LevelForm1","LevelForm2","ItemForm0","ItemForm1","ItemForm2",
"HappinessForm0","HappinessForm1","HappinessForm2","LevelDayForm0",
"LevelDayForm1","LevelDayForm2","LevelNightForm0","LevelNightForm1",
"LevelNightForm2","HoldItemForm0","HoldItemForm1","HoldItemForm2",
"LevelDayTime","Crits","HasMoveForm0","HasMoveForm1","HasMoveForm2"
]
i=0 if i>=ret.length || i<0
return ret[i]
end
|
Funciones de ayuda a la evolución
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'scripts/Pokemon_Evolution.rb', line 97
def pbGetEvolvedFormData(species)
ret=[]
_EVOTYPEMASK=0x3F
_EVODATAMASK=0xC0
_EVONEXTFORM=0x00
pbRgssOpen("Data/evolutions.dat","rb"){|f|
f.pos=(species-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
evo=f.fgetb
evonib=evo&_EVOTYPEMASK
level=f.fgetw
poke=f.fgetw
if (evo&_EVODATAMASK)==_EVONEXTFORM
ret.push([evonib,level,poke])
end
i+=5
end
end
}
return ret
end
|
#pbGetExceptionMessage(e, script = "") ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'scripts/Compiler.rb', line 9
def pbGetExceptionMessage(e,script="")
emessage=e.message
if e.is_a?(Hangup)
emessage="El script está tomando mucho tiempo. El juego se reiniciará."
elsif e.is_a?(Errno::ENOENT)
filename=emessage.sub("No existe dicho archivo o carpeta - ", "")
emessage="Archivo #{filename} no encontrado."
end
if emessage && !safeExists?("Game.rgssad") && !safeExists?("Game.rgss2a")
emessage=emessage.gsub(/uninitialized constant PBItems\:\:(\S+)/){
"El objeto '#{$1}' no es válida. Agregue el objeto\r\na la lista de objetos en el editor. Consulta más información en la wiki." }
emessage=emessage.gsub(/undefined method `(\S+?)' for PBItems\:Module/){
"El objeto '#{$1}' no es válida. Agregue el objeto\r\na la lista de objetos en el editor. Consulta más información en la wiki." }
emessage=emessage.gsub(/uninitialized constant PBTypes\:\:(\S+)/){
"El tipo '#{$1}' no es válida. Agregue el tipo\r\nal archivo PBS/types.txt." }
emessage=emessage.gsub(/undefined method `(\S+?)' for PBTypes\:Module/){
"El tipo '#{$1}' no es válida. Agregue el tipo\r\nal archivo PBS/types.txt." }
emessage=emessage.gsub(/uninitialized constant PBTrainers\:\:(\S+)$/){
"El tipo de entrenador '#{$1}' no es válida. Agregue el entrenador\r\na la lista de tipos de entrenadores en el Editor. Consulta más\r\ninformación en la wiki." }
emessage=emessage.gsub(/undefined method `(\S+?)' for PBTrainers\:Module/){
"El tipo de entrenador '#{$1}' no es válida. Agregue el entrenador\r\na la lista de tipos de entrenadores en el Editor. Consulta más\r\ninformación en la wiki." }
emessage=emessage.gsub(/uninitialized constant PBSpecies\:\:(\S+)$/){
"La especie Pokemon '#{$1}' no es válida. Agregue\r\nla especie al archivo PBS/pokemon.txt.\r\nConsulta más información en la wiki." }
emessage=emessage.gsub(/undefined method `(\S+?)' for PBSpecies\:Module/){
"La especie Pokemon '#{$1}' no es válida. Agregue\r\nla especie al archivo PBS/pokemon.txt.\r\nConsulta más información en la wiki." }
end
return emessage
end
|
#pbGetFileChar(file) ⇒ Object
Gets at least the first byte of a file. Doesn't check RTP, but does check encrypted archives.
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
|
# File 'scripts/SpriteWindow.rb', line 1799
def pbGetFileChar(file)
file=canonicalize(file)
if !(safeExists?("./Game.rgssad") || safeExists?("./Game.rgss2a"))
return nil if !safeExists?(file)
begin
File.open(file,"rb"){|f|
return f.read(1) }
rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES
return nil
end
end
Marshal.neverload=true
str=nil
begin
str=load_data(file)
rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError
str=nil
ensure
Marshal.neverload=false
end
return str
end
|
#pbGetFileString(file) ⇒ Object
Gets the contents of a file. Doesn't check RTP, but does check encrypted archives.
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
|
# File 'scripts/SpriteWindow.rb', line 1825
def pbGetFileString(file)
file=canonicalize(file)
if !(safeExists?("./Game.rgssad") || safeExists?("./Game.rgss2a"))
return nil if !safeExists?(file)
begin
File.open(file,"rb"){|f|
return f.read }
rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES
return nil
end
end
Marshal.neverload=true
str=nil
begin
str=load_data(file)
rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError
str=nil
ensure
Marshal.neverload=false
end
return str
end
|
#pbGetFreeTrainerParty(trainerid, trainername) ⇒ Object
168
169
170
171
172
173
174
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 168
def pbGetFreeTrainerParty(trainerid,trainername)
for i in 0...256
trainer=pbLoadTrainer(trainerid,trainername,i)
return i if !trainer
end
return -1
end
|
#pbGetGoldString ⇒ Object
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
|
# File 'scripts/Messages.rb', line 1202
def pbGetGoldString
moneyString=""
if $Trainer
moneyString=_INTL("${1}",$Trainer.money)
else
if $data_system.respond_to?("words")
moneyString=_INTL("{1} {2}",$game_party.gold,$data_system.words.gold)
else
moneyString=_INTL("{1} {2}",$game_party.gold,Vocab.gold)
end
end
return moneyString
end
|
#pbGetItemConst(i) ⇒ Object
#pbGetLegalMoves(species) ⇒ Object
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
|
# File 'scripts/Editor.rb', line 2926
def pbGetLegalMoves(species)
moves=[]
return moves if !species || species<=0
pbRgssOpen("Data/attacksRS.dat","rb") {|atkdata|
offset=atkdata.getOffset(species-1)
length=atkdata.getLength(species-1)>>1
atkdata.pos=offset
for k in 0..length-1
level=atkdata.fgetw
move=atkdata.fgetw
moves.push(move)
end
}
itemData=readItemList("Data/items.dat")
tmdat=load_data("Data/tm.dat")
for i in 0...itemData.length
next if !itemData[i]
atk=itemData[i][8]
next if !atk || atk==0
next if !tmdat[atk]
if tmdat[atk].any? {|item| item==species }
moves.push(atk)
end
end
babyspecies=pbGetBabySpecies(species)
pbRgssOpen("Data/eggEmerald.dat","rb"){|f|
f.pos=(babyspecies-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
atk=f.fgetw
moves.push(atk)
i+=1
end
end
}
moves|=[]
return moves
end
|
#pbGetLegalMoves2(species, maxlevel) ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 72
def pbGetLegalMoves2(species,maxlevel)
moves=[]
return moves if !species || species<=0
pbRgssOpen("Data/attacksRS.dat","rb") {|atkdata|
offset=atkdata.getOffset(species-1)
length=atkdata.getLength(species-1)>>1
atkdata.pos=offset
for k in 0..length-1
level=atkdata.fgetw
move=atkdata.fgetw
if level<=maxlevel
addMove(moves,move,1)
end
end
}
$tmData=load_data("Data/tm.dat") if !$tmData
if !$tmMoves
$tmMoves=[]
itemData=readItemList("Data/items.dat") if !itemData
for i in 0...itemData.length
next if !itemData[i]
atk=itemData[i][8]
next if !atk || atk==0
next if !$tmData[atk]
$tmMoves.push(atk)
end
end
for atk in $tmMoves
if $tmData[atk].include?(species)
addMove(moves,atk,0)
end
end
babyspecies=babySpecies(species)
pbRgssOpen("Data/eggEmerald.dat","rb"){|f|
f.pos=(babyspecies-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
atk=f.fgetw
addMove(moves,atk,2)
i+=1
end
end
}
movedatas=[]
for move in moves
movedatas.push([move,moveData(move)])
end
deleteAll=proc{|a,item|
while a.include?(item)
a.delete(item)
end
}
for move in moves
md=moveData(move)
for move2 in movedatas
if md.function==0xA5 && move2[1].function==0 && md.type==move2[1].type &&
md.basedamage>=move2[1].basedamage
deleteAll.call(moves,move2[0])
elsif md.function==move2[1].function && md.basedamage==0 &&
md.accuracy>move2[1].accuracy
deleteAll.call(moves,move2[0])
elsif md.function==0x06 && move2[1].function==0x05
deleteAll.call(moves,move2[0])
elsif md.function==move2[1].function && md.basedamage!=0 &&
md.type==move2[1].type &&
(md.totalpp==15 || md.totalpp==10 || md.totalpp==move2[1].totalpp) &&
(md.basedamage>move2[1].basedamage ||
(md.basedamage==move2[1].basedamage && md.accuracy>move2[1].accuracy))
deleteAll.call(moves,move2[0])
end
end
end
return moves
end
|
#pbGetMapNameFromId(id) ⇒ Object
988
989
990
991
992
993
994
|
# File 'scripts/Messages.rb', line 988
def pbGetMapNameFromId(id)
map=pbGetBasicMapNameFromId(id)
if $Trainer
map.gsub!(/\\PN/,$Trainer.name)
end
return map
end
|
#pbGetMessage(type, id) ⇒ Object
706
707
708
|
# File 'scripts/Intl_Messages.rb', line 706
def pbGetMessage(type,id)
return MessageTypes.get(type,id)
end
|
#pbGetMessageCount(type) ⇒ Object
702
703
704
|
# File 'scripts/Intl_Messages.rb', line 702
def pbGetMessageCount(type)
return MessageTypes.getCount(type)
end
|
#pbGetMessageFromHash(type, id) ⇒ Object
710
711
712
|
# File 'scripts/Intl_Messages.rb', line 710
def pbGetMessageFromHash(type,id)
return MessageTypes.getFromHash(type,id)
end
|
134
135
136
137
138
|
# File 'scripts/MiscData.rb', line 134
def pbGetMetadata(mapid,metadataType)
meta=pbLoadMetadata
return meta[mapid][metadataType] if meta[mapid]
return nil
end
|
#pbGetMinimumLevel(species) ⇒ Object
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# File 'scripts/Pokemon_Evolution.rb', line 177
def pbGetMinimumLevel(species)
ret=-1
_EVOTYPEMASK=0x3F
_EVODATAMASK=0xC0
_EVOPREVFORM=0x40
pbRgssOpen("Data/evolutions.dat","rb"){|f|
f.pos=(species-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
evo=f.fgetb
evonib=evo&_EVOTYPEMASK
level=f.fgetw
poke=f.fgetw
if poke<=PBSpecies.maxValue &&
(evo&_EVODATAMASK)==_EVOPREVFORM && [PBEvolution::Level,PBEvolution::LevelMale,
PBEvolution::LevelFemale,PBEvolution::AttackGreater,
PBEvolution::AtkDefEqual,PBEvolution::DefenseGreater,
PBEvolution::Silcoon,PBEvolution::Cascoon,
PBEvolution::Ninjask,PBEvolution::Shedinja,
PBEvolution::LevelDay,PBEvolution::LevelNight,
PBEvolution::LevelDarkInParty,PBEvolution::LevelRain,
PBEvolution::LevelForm0,PBEvolution::LevelForm1,
PBEvolution::LevelForm2,PBEvolution::LevelDayForm0,
PBEvolution::LevelDayForm1,PBEvolution::LevelDayForm2,
PBEvolution::LevelNightForm0,PBEvolution::LevelNightForm1,
PBEvolution::LevelNightForm2,PBEvolution::LevelDayTime].include?(evonib)
ret=(ret==-1) ? level : [ret,level].min
break
end
i+=5
end
end
}
return (ret==-1) ? 1 : ret
end
|
#pbGetMoveConst(i) ⇒ Object
#pbGetPlayerCharset(meta, charset, trainer = nil) ⇒ Object
This method causes a lot of lag when the game is encrypted
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
|
# File 'scripts/PField_Field.rb', line 1422
def pbGetPlayerCharset(meta,charset,trainer=nil)
trainer=$Trainer if !trainer
outfit=trainer ? trainer.outfit : 0
ret=meta[charset]
ret=meta[1] if !ret || ret==""
if pbResolveBitmap("Graphics/Characters/"+ret+"_"+outfit.to_s)
ret=ret+"_"+outfit.to_s
end
return ret
end
|
#pbGetPocket(item) ⇒ Object
26
27
28
|
# File 'scripts/PItem_Items.rb', line 26
def pbGetPocket(item)
return $ItemData[item][ITEMPOCKET]
end
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
# File 'scripts/Pokemon_Evolution.rb', line 152
def pbGetPreviousForm(species)
_EVOTYPEMASK=0x3F
_EVODATAMASK=0xC0
_EVOPREVFORM=0x40
pbRgssOpen("Data/evolutions.dat","rb"){|f|
f.pos=(species-1)*8
offset=f.fgetdw
length=f.fgetdw
if length>0
f.pos=offset
i=0; loop do break unless i<length
evo=f.fgetb
evonib=evo&_EVOTYPEMASK
level=f.fgetw
poke=f.fgetw
if (evo&_EVODATAMASK)==_EVOPREVFORM
return poke
end
i+=5
end
end
}
return species
end
|
#pbGetPrice(item) ⇒ Object
22
23
24
|
# File 'scripts/PItem_Items.rb', line 22
def pbGetPrice(item)
return $ItemData[item][ITEMPRICE]
end
|
#pbGetRelearnableMoves(pokemon) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'scripts/PScreen_MoveRelearner.rb', line 12
def pbGetRelearnableMoves(pokemon)
return [] if !pokemon || pokemon.isEgg? || (pokemon.isShadow? rescue false)
moves=[]
pbEachNaturalMove(pokemon){|move,level|
if level<=pokemon.level && !pokemon.hasMove?(move)
moves.push(move) if !moves.include?(move)
end
}
tmoves=[]
if pokemon.firstmoves
for i in pokemon.firstmoves
tmoves.push(i) if !pokemon.hasMove?(i) && !moves.include?(i)
end
end
moves=tmoves+moves
return moves|[] end
|
#pbGetSeason ⇒ Object
287
288
289
|
# File 'scripts/PField_Time.rb', line 287
def pbGetSeason
return (pbGetTimeNow.mon-1)%4
end
|
#pbGetSeasonName(season) ⇒ Object
314
315
316
317
318
319
|
# File 'scripts/PField_Time.rb', line 314
def pbGetSeasonName(season)
return [_INTL("Primavera"),
_INTL("Verano"),
_INTL("Otoño"),
_INTL("Invierno")][season]
end
|
#pbGetSpeciesConst(i) ⇒ Object
#pbGetTerrainTag(event = nil, countBridge = false) ⇒ Object
2294
2295
2296
2297
2298
2299
2300
2301
2302
|
# File 'scripts/PField_Field.rb', line 2294
def pbGetTerrainTag(event=nil,countBridge=false)
event=$game_player if !event
return 0 if !event
if $MapFactory
return $MapFactory.getTerrainTag(event.map.map_id,event.x,event.y,countBridge)
else
$game_map.terrain_tag(event.x,event.y,countBridge)
end
end
|
#pbGetText(infile) ⇒ Object
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
# File 'scripts/Intl_Messages.rb', line 221
def pbGetText(infile)
begin
file=File.open(infile,"rb")
rescue
raise _INTL("No se pudo encontrar {1}",infile)
end
intldat=[]
begin
pbEachIntlSection(file){|section,name|
index=name
if section.length==0
next
end
if !name[/^([Mm][Aa][Pp])?(\d+)$/]
raise _INTL("Nombre de sección inválido {1}",name)
end
ismap=$~[1] && $~[1]!=""
id=$~[2].to_i
itemlength=0
if section[0][/^\d+$/]
intlhash=[]
itemlength=3
if ismap
raise _INTL("La sección {1} no puede ser una lista ordenada (la sección ha sido interpretada como una lista ordenada porque su primer línea es un número)",name)
end
if section.length%3!=0
raise _INTL("La cuenta de líneas de la sección {1} no es divisible en 3 (la sección ha sido interpretada como una lista ordenada porque su primer línea es un número)",name)
end
else
intlhash=OrderedHash.new
itemlength=2
if section.length%2!=0
raise _INTL("La sección {1} tiene una cantidad extraña de entradas (la sección ha sido interpretada como una hash porque su primer línea no es un número)",name)
end
end
i=0;loop do break unless i<section.length
if itemlength==3
if !section[i][/^\d+$/]
raise _INTL("Se esperaba un número en la sección {1}, en su lugar se obtuvo {2}",name,section[i])
end
key=section[i].to_i
i+=1
else
key=MessageTypes.denormalizeValue(section[i])
end
intlhash[key]=MessageTypes.denormalizeValue(section[i+1])
i+=2
end
if ismap
intldat[0]=[] if !intldat[0]
intldat[0][id]=intlhash
else
intldat[id]=intlhash
end
}
ensure
file.close
end
return intldat
end
|
#pbGetTileBitmap(filename, tile_id, hue) ⇒ Object
244
245
246
247
248
|
# File 'scripts/SpriteWindow.rb', line 244
def pbGetTileBitmap(filename, tile_id, hue)
return BitmapCache.tileEx(filename, tile_id, hue){|f|
AnimatedBitmap.new("Graphics/Tilesets/"+filename).deanimate;
}
end
|
#pbGetTileset(name, hue = 0) ⇒ Object
254
255
256
|
# File 'scripts/SpriteWindow.rb', line 254
def pbGetTileset(name,hue=0)
return AnimatedBitmap.new("Graphics/Tilesets/"+name,hue).deanimate
end
|
#pbGetTimeNow ⇒ Object
4
5
6
|
# File 'scripts/PField_Time.rb', line 4
def pbGetTimeNow
return Time.now
end
|
#pbGetTrainerConst(i) ⇒ Object
#pbGetTypeConst(i) ⇒ Object
56
57
58
59
60
61
62
63
64
65
|
# File 'scripts/Editor.rb', line 56
def pbGetTypeConst(i)
ret=MakeshiftConsts.get(MessageTypes::Types,i,PBTypes)
if !ret
ret=["NORMAL","FIGHTING","FLYING","POISON","GROUND",
"ROCK","BUG","GHOST","STEEL","QMARKS",
"FIRE","WATER","GRASS","ELECTRIC",
"PSYCHIC","ICE","DRAGON","DARK","FAIRY"][i]
end
return ret
end
|
#pbGiveTriadCard(species, quantity = 1) ⇒ Object
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
|
# File 'scripts/PMinigame_TripleTriad.rb', line 1311
def pbGiveTriadCard(species,quantity=1)
if species.is_a?(String) || species.is_a?(Symbol)
species=getID(PBSpecies,species)
end
return false if !species || species<=0
if $PokemonGlobal.triads.pbCanStore?(species,quantity)
$PokemonGlobal.triads.pbStoreItem(species,quantity)
return true
end
return false
end
|
#pbHallOfFameEntry ⇒ Object
498
499
500
501
502
|
# File 'scripts/PScreen_HallOfFame.rb', line 498
def pbHallOfFameEntry
scene=HallOfFameScene.new
screen=HallOfFameScreen.new(scene)
screen.pbStartScreenEntry
end
|
#pbHallOfFamePC ⇒ Object
504
505
506
507
508
|
# File 'scripts/PScreen_HallOfFame.rb', line 504
def pbHallOfFamePC
scene=HallOfFameScene.new
screen=HallOfFameScreen.new(scene)
screen.pbStartScreenPC
end
|
#pbHasEligible?(*arg) ⇒ Boolean
36
37
38
|
# File 'scripts/PBattle_OrgBattle.rb', line 36
def pbHasEligible?(*arg)
return pbBattleChallenge.rules.ruleset.hasValidTeam?($Trainer.party)
end
|
#pbHasPhoneTrainer?(trtype, trname) ⇒ Boolean
33
34
35
|
# File 'scripts/PScreen_Phone.rb', line 33
def pbHasPhoneTrainer?(trtype,trname)
return pbFindPhoneTrainer!=nil
end
|
#pbHasPurifiableInParty ⇒ Object
181
182
183
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 181
def pbHasPurifiableInParty
return $Trainer.party.any? {|item| pbIsPurifiable?(item) }
end
|
#pbHasRelearnableMove?(pokemon) ⇒ Boolean
8
9
10
|
# File 'scripts/PScreen_MoveRelearner.rb', line 8
def pbHasRelearnableMove?(pokemon)
return pbGetRelearnableMoves(pokemon).length>0
end
|
#pbHatch(pokemon) ⇒ Object
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
# File 'scripts/PScreen_EggHatching.rb', line 175
def pbHatch(pokemon)
speciesname=PBSpecies.getName(pokemon.species)
pokemon.name=speciesname
pokemon.trainerID=$Trainer.id
pokemon.ot=$Trainer.name
pokemon.happiness=120
pokemon.timeEggHatched=pbGetTimeNow
pokemon.obtainMode=1 pokemon.hatchedMap=$game_map.map_id
$Trainer.seen[pokemon.species]=true
$Trainer.owned[pokemon.species]=true
pbSeenForm(pokemon)
pokemon.pbRecordFirstMoves
if !pbHatchAnimation(pokemon)
Kernel.pbMessage(_INTL("¿Y ésto?\1"))
Kernel.pbMessage(_INTL("...\1"))
Kernel.pbMessage(_INTL("... .... .....\1"))
Kernel.pbMessage(_INTL("¡{1} ha salido del huevo!",speciesname))
if Kernel.pbConfirmMessage(_INTL("¿Quieres darle un apodo al {1} recién nacido?",speciesname))
species=PBSpecies.getName(pokemon.species)
nickname=pbEnterPokemonName(_INTL("Apodo de {1}",speciesname),0,10,"",pokemon)
pokemon.name=nickname if nickname!=""
end
end
end
|
#pbHatchAnimation(pokemon) ⇒ Object
165
166
167
168
169
170
171
172
173
|
# File 'scripts/PScreen_EggHatching.rb', line 165
def pbHatchAnimation(pokemon)
Kernel.pbMessage(_INTL("¿Y ésto?\1"))
pbFadeOutInWithMusic(99999) {
scene=PokemonEggHatchScene.new
screen=PokemonEggHatchScreen.new(scene)
screen.pbStartScreen(pokemon)
}
return true
end
|
#pbHelpWindow ⇒ Object
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
|
# File 'scripts/BattleAnimationEditor.rb', line 2698
def pbHelpWindow
helptext=""+
"To add a cel to the scene, click on the canvas. The selected cel will have a black "+
"frame. After a cel is selected, you can modify its properties using the keyboard:\n"+
"E, R - Rotate left/right;\nP - Open properties screen;\nArrow keys - Move cel 8 pixels "+
"(hold ALT for 2 pixels);\n+/- : Zoom in/out;\nL - Lock a cel. Locking a cel prevents it "+
"from being moved or deleted.\nDEL - Deletes the cel.\nAlso press TAB to switch the selected cel."
cmdwin=Window_UnformattedTextPokemon.newWithSize("",0,0,640,512)
cmdwin.opacity=224
cmdwin.z=99999
cmdwin.text=helptext
loop do
Graphics.update
Input.update
cmdwin.update
if Input.trigger?(Input::C)
break
end
if Input.trigger?(Input::B)
break
end
end
cmdwin.dispose
end
|
#pbHiddenMoveAnimation(pokemon) ⇒ Object
Animación de los movimientos ocultos
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
# File 'scripts/PField_HiddenMoves.rb', line 155
def pbHiddenMoveAnimation(pokemon)
return false if !pokemon
viewport=Viewport.new(0,0,0,0)
viewport.z=99999
bg=Sprite.new(viewport)
bg.bitmap=BitmapCache.load_bitmap("Graphics/Pictures/hiddenMovebg")
sprite=PokemonSprite.new(viewport)
sprite.setPokemonBitmap(pokemon)
sprite.z=1
sprite.ox=sprite.bitmap.width/2
sprite.oy=sprite.bitmap.height/2
sprite.visible=false
strobebitmap=AnimatedBitmap.new("Graphics/Pictures/hiddenMoveStrobes")
strobes=[]
15.times do |i|
strobe=BitmapSprite.new(26*2,8*2,viewport)
strobe.bitmap.blt(0,0,strobebitmap.bitmap,Rect.new(0,(i%2)*8*2,26*2,8*2))
strobe.z=((i%2)==0 ? 2 : 0)
strobe.visible=false
strobes.push(strobe)
end
strobebitmap.dispose
interp=RectInterpolator.new(
Rect.new(0,Graphics.height/2,Graphics.width,0),
Rect.new(0,(Graphics.height-bg.bitmap.height)/2,Graphics.width,bg.bitmap.height),
10)
ptinterp=nil
phase=1
frames=0
begin
Graphics.update
Input.update
sprite.update
case phase
when 1 interp.update
interp.set(viewport.rect)
bg.oy=(bg.bitmap.height-viewport.rect.height)/2
if interp.done?
phase=2
ptinterp=PointInterpolator.new(
Graphics.width+(sprite.bitmap.width/2),bg.bitmap.height/2,
Graphics.width/2,bg.bitmap.height/2,
16)
end
when 2 ptinterp.update
sprite.x=ptinterp.x
sprite.y=ptinterp.y
sprite.visible=true
if ptinterp.done?
phase=3
pbPlayCry(pokemon)
frames=0
end
when 3 frames+=1
if frames>30
phase=4
ptinterp=PointInterpolator.new(
Graphics.width/2,bg.bitmap.height/2,
-(sprite.bitmap.width/2),bg.bitmap.height/2,
16)
frames=0
end
when 4 ptinterp.update
sprite.x=ptinterp.x
sprite.y=ptinterp.y
if ptinterp.done?
phase=5
sprite.visible=false
interp=RectInterpolator.new(
Rect.new(0,(Graphics.height-bg.bitmap.height)/2,Graphics.width,bg.bitmap.height),
Rect.new(0,Graphics.height/2,Graphics.width,0),
10)
end
when 5 interp.update
interp.set(viewport.rect)
bg.oy=(bg.bitmap.height-viewport.rect.height)/2
phase=6 if interp.done?
end
for strobe in strobes
strobe.ox=strobe.viewport.rect.x
strobe.oy=strobe.viewport.rect.y
if !strobe.visible
randomY=16*(1+rand(bg.bitmap.height/16-2))
strobe.y=randomY+(Graphics.height-bg.bitmap.height)/2
strobe.x=rand(Graphics.width)
strobe.visible=true
elsif strobe.x<Graphics.width
strobe.x+=32
else
randomY=16*(1+rand(bg.bitmap.height/16-2))
strobe.y=randomY+(Graphics.height-bg.bitmap.height)/2
strobe.x=-strobe.bitmap.width-rand(Graphics.width/4)
end
end
pbUpdateSceneMap
end while phase!=6
sprite.dispose
for strobe in strobes
strobe.dispose
end
strobes.clear
bg.dispose
viewport.dispose
return true
end
|
#pbHiddenPower(iv) ⇒ Object
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
|
# File 'scripts/PokeBattle_MoveEffects.rb', line 3930
def pbHiddenPower(iv)
powermin=30
powermax=70
type=0; base=0
types=[]
for i in 0..PBTypes.maxValue
types.push(i) if !PBTypes.isPseudoType?(i) &&
!isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
end
type|=(iv[PBStats::HP]&1)
type|=(iv[PBStats::ATTACK]&1)<<1
type|=(iv[PBStats::DEFENSE]&1)<<2
type|=(iv[PBStats::SPEED]&1)<<3
type|=(iv[PBStats::SPATK]&1)<<4
type|=(iv[PBStats::SPDEF]&1)<<5
type=(type*(types.length-1)/63).floor
hptype=types[type]
base|=(iv[PBStats::HP]&2)>>1
base|=(iv[PBStats::ATTACK]&2)
base|=(iv[PBStats::DEFENSE]&2)<<1
base|=(iv[PBStats::SPEED]&2)<<2
base|=(iv[PBStats::SPATK]&2)<<3
base|=(iv[PBStats::SPDEF]&2)<<4
base=(base*(powermax-powermin)/63).floor+powermin
return [hptype,base]
end
|
#pbHPItem(pokemon, restorehp, scene) ⇒ Object
338
339
340
341
342
343
344
345
346
347
348
|
# File 'scripts/PItem_Items.rb', line 338
def pbHPItem(pokemon,restorehp,scene)
if pokemon.hp<=0 || pokemon.hp==pokemon.totalhp || pokemon.isEgg?
scene.pbDisplay(_INTL("No tuvo ningún efecto."))
return false
else
hpgain=pbItemRestoreHP(pokemon,restorehp)
scene.pbRefresh
scene.pbDisplay(_INTL("Los PS de {1} subieron en {2} puntos.",pokemon.name,hpgain))
return true
end
end
|
#pbHttpRequest(host, request, filename = nil, depth = 0) ⇒ Object
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
|
# File 'scripts/Sockets.rb', line 582
def pbHttpRequest(host, request, filename=nil, depth=0)
if depth>10
raise "Redirection level too deep"
end
socket=::TCPSocket.new(host, 80)
time=Time.now.to_i
begin
socket.send(request)
result=socket.gets
data=""
if result[/^HTTP\/1\.[01] (\d+).*/]
errorcode=$1.to_i
if errorcode>=400 && errorcode<500
raise "HTTP Error #{errorcode}"
end
={}
while true
result=socket.gets.sub(/\r$/,"")
break if result==""
if result[/^([^:]+):\s*(.*)/]
[$1]=$2
end
end
length=-1
chunked=false
if ["Content-Length"]
length=["Content-Length"].to_i
end
if ["Transfer-Encoding"]=="chunked"
chunked=true
end
if ["Location"] && errorcode >= 300 && errorcode < 400
socket.close rescue socket=nil
return pbDownloadData(["Location"],filename,depth+1)
end
if chunked==true
while true
lengthline=socket.gets.sub(/\r$/,"")
length=lengthline.to_i(16)
break if length==0
while Time.now.to_i-time>=5 || socket.select(10)==0
time=Time.now.to_i
Graphics.update
end
data+=socket.recv(length)
socket.gets
end
elsif length==-1
while true
if socket.select(500)==0
break
else
while Time.now.to_i-time>=5 || socket.select(10)==0
time=Time.now.to_i
Graphics.update
end
data+=socket.recv(1)
end
end
else
while length>0
chunk=[length,4096].min
while Time.now.to_i-time>=5 || socket.select(10)==0
time=Time.now.to_i
Graphics.update
end
data+=socket.recv(chunk)
length-=chunk
end
end
end
if filename
File.open(filename,"wb"){|f|
f.write(data)
}
else
return data
end
ensure
socket.close rescue socket=nil
end
return ""
end
|
#pbImportAnim(animations, canvas, animwin) ⇒ Object
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
|
# File 'scripts/BattleAnimationEditor.rb', line 2927
def pbImportAnim(animations,canvas,animwin)
animfiles=[]
pbRgssChdir(".") {
animfiles.concat(Dir.glob("*.anm"))
}
cmdwin=pbListWindow(animfiles,320)
cmdwin.opacity=200
cmdwin.height=480
cmdwin.viewport=canvas.viewport
loop do
Graphics.update
Input.update
cmdwin.update
if (Input.trigger?(Input::C) || (cmdwin.doubleclick? rescue false)) && animfiles.length>0
begin
textdata=loadBase64Anim(IO.read(animfiles[cmdwin.index]))
throw "Bad data" if !textdata.is_a?(PBAnimation)
textdata.id=-1 pbConvertAnimToNewFormat(textdata)
animations[animations.selected]=textdata
rescue
Kernel.pbMessage(_INTL("The animation is invalid or could not be loaded."))
next
end
graphic=animations[animations.selected].graphic
graphic="Graphics/Animations/#{graphic}"
if graphic && graphic!="" && !FileTest.image_exist?(graphic)
Kernel.pbMessage(_INTL("The animation file {1} was not found. The animation will load anyway.",graphic))
end
canvas.loadAnimation(animations[animations.selected])
animwin.animbitmap=canvas.animbitmap
break
end
if Input.trigger?(Input::B)
break
end
end
cmdwin.dispose
return
end
|
#pbImportNewMaps ⇒ Object
Se agregan los archivos de mapas nuevos al árbol de mapas
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
|
# File 'scripts/Compiler.rb', line 4028
def pbImportNewMaps
return false if !$DEBUG
mapfiles={}
Dir.chdir("Data"){
mapdata=sprintf("Map*.%s","rxdata",$RPGVX ? "rvdata" : "rxdata")
for map in Dir.glob(mapdata)
if map[/map(\d+)\.rxdata/i]
mapfiles[$1.to_i(10)]=true
end
end
}
mapinfos=pbLoadRxData("Data/MapInfos")
maxOrder=0
for id in mapinfos.keys
next if !mapinfos.id
if mapfiles[id]
mapfiles.delete(id)
end
maxOrder=[maxOrder,mapinfos[id].order].max
end
maxOrder+=1
imported=false
for id in mapfiles.keys
next if id==999 mapname=sprintf("MAP%03d",id)
mapinfo=RPG::MapInfo.new
mapinfo.order=maxOrder
maxOrder+=1
mapinfo.name=mapname
mapinfos[id]=mapinfo
imported=true
end
if imported
if $RPGVX
save_data(mapinfos,"Data/MapInfos.rvdata")
else
save_data(mapinfos,"Data/MapInfos.rxdata")
end
Kernel.pbMessage(_INTL("Los mapas nuevos en la carpeta Data fueron importados correctamente.",id))
end
return imported
end
|
#pbInBugContest? ⇒ Boolean
Returns true if the Bug Catching Contest in progress
258
259
260
|
# File 'scripts/PBattle_BugContest.rb', line 258
def pbInBugContest?
return pbBugContestState.inProgress?
end
|
#pbInSafari? ⇒ Boolean
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'scripts/PBattle_Safari.rb', line 61
def pbInSafari?
if pbSafariState.inProgress?
reception=pbSafariState.pbReceptionMap
return true if $game_map.map_id==reception
if pbGetMetadata($game_map.map_id,MetadataSafariMap)
return true
end
end
return false
end
|
#pbIsAutumn ⇒ Object
310
|
# File 'scripts/PField_Time.rb', line 310
def pbIsAutumn; return pbIsSeason(0,2); end
|
#pbIsBanned?(pokemon) ⇒ Boolean
1021
1022
1023
|
# File 'scripts/PBattle_OrgBattle.rb', line 1021
def pbIsBanned?(pokemon)
return StandardSpeciesRestriction.new.isValid?(pokemon)
end
|
#pbIsBerry?(item) ⇒ Boolean
62
63
64
|
# File 'scripts/PItem_Items.rb', line 62
def pbIsBerry?(item)
return $ItemData[item] && ($ItemData[item][ITEMTYPE]==5)
end
|
#pbIsDitto?(pokemon) ⇒ Boolean
52
53
54
55
56
57
58
59
60
|
# File 'scripts/PField_DayCare.rb', line 52
def pbIsDitto?(pokemon)
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,pokemon.species,31)
compat10=dexdata.fgetb
compat11=dexdata.fgetb
dexdata.close
return isConst?(compat10,PBEggGroups,:Ditto) ||
isConst?(compat11,PBEggGroups,:Ditto)
end
|
#pbIsEvolutionStone?(item) ⇒ Boolean
81
82
83
84
85
86
87
88
|
# File 'scripts/PItem_Items.rb', line 81
def pbIsEvolutionStone?(item)
stones=[:FIRESTONE,:THUNDERSTONE,:WATERSTONE,:LEAFSTONE,:MOONSTONE,
:SUNSTONE,:DUSKSTONE,:DAWNSTONE,:SHINYSTONE,:ICESTONE]
for i in stones
return true if isConst?(item,PBItems,i)
end
return false
end
|
#pbIsFaded? ⇒ Boolean
1224
1225
1226
1227
1228
1229
1230
|
# File 'scripts/SpriteWindow.rb', line 1224
def pbIsFaded?
if $game_temp
return $game_temp.fadestate>0
else
return false
end
end
|
#pbIsFall ⇒ Object
311
|
# File 'scripts/PField_Time.rb', line 311
def pbIsFall; return pbIsAutumn; end
|
#pbIsGem?(item) ⇒ Boolean
70
71
72
73
74
75
76
77
78
79
|
# File 'scripts/PItem_Items.rb', line 70
def pbIsGem?(item)
gems=[:FIREGEM,:WATERGEM,:ELECTRICGEM,:GRASSGEM,:ICEGEM,
:FIGHTINGGEM,:POISONGEM,:GROUNDGEM,:FLYINGGEM,:PSYCHICGEM,
:BUGGEM,:ROCKGEM,:GHOSTGEM,:DRAGONGEM,:DARKGEM,
:STEELGEM,:NORMALGEM,:FAIRYGEM]
for i in gems
return true if isConst?(item,PBItems,i)
end
return false
end
|
#pbIsHiddenMachine?(item) ⇒ Boolean
45
46
47
|
# File 'scripts/PItem_Items.rb', line 45
def pbIsHiddenMachine?(item)
return $ItemData[item] && ($ItemData[item][ITEMUSE]==4)
end
|
#pbIsHiddenMove?(move) ⇒ Boolean
12
13
14
15
16
17
18
19
20
|
# File 'scripts/PItem_Items.rb', line 12
def pbIsHiddenMove?(move)
return false if !$ItemData
for i in 0...$ItemData.length
next if !pbIsHiddenMachine?(i)
atk=$ItemData[i][ITEMMACHINE]
return true if move==atk
end
return false
end
|
#pbIsImportantItem?(item) ⇒ Boolean
Los objetos importantes no se pueden vender, dar o tirar.
#pbIsKeyItem?(item) ⇒ Boolean
66
67
68
|
# File 'scripts/PItem_Items.rb', line 66
def pbIsKeyItem?(item)
return $ItemData[item] && ($ItemData[item][ITEMTYPE]==6)
end
|
#pbIsMachine?(item) ⇒ Boolean
#pbIsMail?(item) ⇒ Boolean
49
50
51
|
# File 'scripts/PItem_Items.rb', line 49
def pbIsMail?(item)
return $ItemData[item] && ($ItemData[item][ITEMTYPE]==1 || $ItemData[item][ITEMTYPE]==2)
end
|
#pbIsMegaStone?(item) ⇒ Boolean
Does NOT include Red Orb/Blue Orb
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'scripts/PItem_Items.rb', line 90
def pbIsMegaStone?(item) stones=[:ABOMASITE,:ABSOLITE,:AERODACTYLITE,:AGGRONITE,:ALAKAZITE,
:ALTARIANITE,:AMPHAROSITE,:AUDINITE,:BANETTITE,:BEEDRILLITE,
:BLASTOISINITE,:BLAZIKENITE,:CAMERUPTITE,:CHARIZARDITEX,:CHARIZARDITEY,
:DIANCITE,:GALLADITE,:GARCHOMPITE,:GARDEVOIRITE,:GENGARITE,
:GLALITITE,:GYARADOSITE,:HERACRONITE,:HOUNDOOMINITE,:KANGASKHANITE,
:LATIASITE,:LATIOSITE,:LOPUNNITE,:LUCARIONITE,:MANECTITE,
:MAWILITE,:MEDICHAMITE,:METAGROSSITE,:MEWTWONITEX,:MEWTWONITEY,
:PIDGEOTITE,:PINSIRITE,:SABLENITE,:SALAMENCITE,:SCEPTILITE,
:SCIZORITE,:SHARPEDONITE,:SLOWBRONITE,:STEELIXITE,:SWAMPERTITE,
:TYRANITARITE,:VENUSAURITE]
for i in stones
return true if isConst?(item,PBItems,i)
end
return false
end
|
#pbIsMonth(monVariable, *arg) ⇒ Object
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
# File 'scripts/PField_Time.rb', line 242
def pbIsMonth(monVariable,*arg)
timenow=pbGetTimeNow
thismon=timenow.mon
ret=false
for wd in arg
ret=true if wd==thismon
end
if monVariable>0
$game_variables[monVariable]=[
_INTL("Enero"),
_INTL("Febrero"),
_INTL("Marzo"),
_INTL("Abril"),
_INTL("Mayo"),
_INTL("Junio"),
_INTL("Julio"),
_INTL("Agosto"),
_INTL("Septiembre"),
_INTL("Octubre"),
_INTL("Noviembre"),
_INTL("Diciembre")][thismon-1]
$game_map.need_refresh = true if $game_map
end
return ret
end
|
#pbIsMulch?(item) ⇒ Boolean
107
108
109
110
111
112
113
|
# File 'scripts/PItem_Items.rb', line 107
def pbIsMulch?(item)
mulches=[:GROWTHMULCH,:DAMPMULCH,:STABLEMULCH,:GOOEYMULCH]
for i in mulches
return true if isConst?(item,PBItems,i)
end
return false
end
|
#pbIsOldSpecialType?(type) ⇒ Boolean
1
2
3
4
5
6
7
8
9
10
|
# File 'scripts/Editor.rb', line 1
def pbIsOldSpecialType?(type)
return isConst?(type,PBTypes,:FIRE) ||
isConst?(type,PBTypes,:WATER) ||
isConst?(type,PBTypes,:ICE) ||
isConst?(type,PBTypes,:GRASS) ||
isConst?(type,PBTypes,:ELECTRIC) ||
isConst?(type,PBTypes,:PSYCHIC) ||
isConst?(type,PBTypes,:DRAGON) ||
isConst?(type,PBTypes,:DARK)
end
|
#pbIsPokeBall?(item) ⇒ Boolean
58
59
60
|
# File 'scripts/PItem_Items.rb', line 58
def pbIsPokeBall?(item)
return $ItemData[item] && ($ItemData[item][ITEMTYPE]==3 || $ItemData[item][ITEMTYPE]==4)
end
|
#pbIsPurifiable?(pkmn) ⇒ Boolean
172
173
174
175
176
177
178
179
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 172
def pbIsPurifiable?(pkmn)
return false if !pkmn
if pkmn.isShadow? && pkmn.heartgauge==0 &&
!isConst?(pkmn.species,PBSpecies,:LUGIA)
return true
end
return false
end
|
#pbIsSeason(seasonVariable, *arg) ⇒ Object
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
# File 'scripts/PField_Time.rb', line 291
def pbIsSeason(seasonVariable,*arg)
thisseason=pbGetSeason
ret=false
for wd in arg
ret=true if wd==thisseason
end
if seasonVariable>0
$game_variables[seasonVariable]=[
_INTL("Primavera"),
_INTL("Verano"),
_INTL("Otoño"),
_INTL("Invierno")][thisseason]
$game_map.need_refresh = true if $game_map
end
return ret
end
|
#pbIsSnagBall?(item) ⇒ Boolean
53
54
55
56
|
# File 'scripts/PItem_Items.rb', line 53
def pbIsSnagBall?(item)
return $ItemData[item] && ($ItemData[item][ITEMTYPE]==3 ||
($ItemData[item][ITEMTYPE]==4 && $PokemonGlobal.snagMachine))
end
|
#pbIsSpring ⇒ Object
308
|
# File 'scripts/PField_Time.rb', line 308
def pbIsSpring; return pbIsSeason(0,0); end
|
#pbIsSummer ⇒ Object
309
|
# File 'scripts/PField_Time.rb', line 309
def pbIsSummer; return pbIsSeason(0,1); end
|
#pbIsTechnicalMachine?(item) ⇒ Boolean
41
42
43
|
# File 'scripts/PItem_Items.rb', line 41
def pbIsTechnicalMachine?(item)
return $ItemData[item] && ($ItemData[item][ITEMUSE]==3)
end
|
#pbIsWeekday(wdayVariable, *arg) ⇒ Object
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'scripts/PField_Time.rb', line 218
def pbIsWeekday(wdayVariable,*arg)
timenow=pbGetTimeNow
wday=timenow.wday
ret=false
for wd in arg
ret=true if wd==wday
end
if wdayVariable>0
$game_variables[wdayVariable]=[
_INTL("Domingo"),
_INTL("Lunes"),
_INTL("Martes"),
_INTL("Miércoles"),
_INTL("Jueves"),
_INTL("Viernes"),
_INTL("Sábado")][wday]
$game_map.need_refresh = true if $game_map
end
return ret
end
|
#pbIsWinter ⇒ Object
312
|
# File 'scripts/PField_Time.rb', line 312
def pbIsWinter; return pbIsSeason(0,3); end
|
#pbItemRestoreHP(pokemon, restorehp) ⇒ Object
330
331
332
333
334
335
336
|
# File 'scripts/PItem_Items.rb', line 330
def pbItemRestoreHP(pokemon,restorehp)
newhp=pokemon.hp+restorehp
newhp=pokemon.totalhp if newhp>pokemon.totalhp
hpgain=newhp-pokemon.hp
pokemon.hp=newhp
return hpgain
end
|
#pbJustRaiseEffortValues(pokemon, ev, evgain) ⇒ Object
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
|
# File 'scripts/PItem_Items.rb', line 363
def pbJustRaiseEffortValues(pokemon,ev,evgain)
totalev=0
for i in 0...6
totalev+=pokemon.ev[i]
end
if totalev+evgain>PokeBattle_Pokemon::EVLIMIT
evgain-=totalev+evgain-PokeBattle_Pokemon::EVLIMIT
end
if pokemon.ev[ev]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
evgain-=pokemon.ev[ev]+evgain-PokeBattle_Pokemon::EVSTATLIMIT
end
if evgain>0
pokemon.ev[ev]+=evgain
pokemon.calcStats
end
return evgain
end
|
#pbLearnMove(pokemon, move, ignoreifknown = false, bymachine = false, &block) ⇒ Object
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
|
# File 'scripts/PItem_Items.rb', line 522
def pbLearnMove(pokemon,move,ignoreifknown=false,bymachine=false,&block)
return false if !pokemon
movename=PBMoves.getName(move)
if pokemon.isEgg? && !$DEBUG
Kernel.pbMessage(_INTL("Un huevo no puede aprender {1}.",movename),&block)
return false
end
if pokemon.respond_to?("isShadow?") && pokemon.isShadow?
Kernel.pbMessage(_INTL("No se puede enseñar {1} a este Pokémon.",movename),&block)
return false
end
pkmnname=pokemon.name
for i in 0...4
if pokemon.moves[i].id==move
Kernel.pbMessage(_INTL("{1} ya conoce {2}.",pkmnname,movename),&block) if !ignoreifknown
return false
end
if pokemon.moves[i].id==0
pokemon.moves[i]=PBMove.new(move)
Kernel.pbMessage(_INTL("\\se[]¡{1} ha aprendido {2}!\\se[MoveLearnt]",pkmnname,movename),&block)
return true
end
end
loop do
Kernel.pbMessage(_INTL("{1} está intentando aprender {2}.",pkmnname,movename),&block)
Kernel.pbMessage(_INTL("Pero {1} ya conoce cuatro movimientos.",pkmnname),&block)
if Kernel.pbConfirmMessage(_INTL("¿Quieres remplazar un movimiento por {1}?",movename),&block)
Kernel.pbMessage(_INTL("¿Qué movimiento debería olvidar?"),&block)
forgetmove=pbForgetMove(pokemon,move)
if forgetmove>=0
oldmovename=PBMoves.getName(pokemon.moves[forgetmove].id)
oldmovepp=pokemon.moves[forgetmove].pp
pokemon.moves[forgetmove]=PBMove.new(move) pokemon.moves[forgetmove].pp=[oldmovepp,pokemon.moves[forgetmove].totalpp].min if bymachine
Kernel.pbMessage(_INTL("\\se[]1,\\wt[16] 2, y\\wt[16]...\\wt[16] ...\\wt[16] ... ¡Puf!\\se[balldrop]"),&block)
Kernel.pbMessage(_INTL("\\se[]{1} ha olvidado cómo usar {2}. Y... ¡{1} ha aprendido {3}!\\se[MoveLearnt]",pkmnname,oldmovename,movename),&block)
return true
elsif Kernel.pbConfirmMessage(_INTL("¿Prefieres que {1} no aprenda {2}?",pkmnname,movename),&block)
Kernel.pbMessage(_INTL("{1} no ha aprendido {2}.",pkmnname,movename),&block)
return false
end
elsif Kernel.pbConfirmMessage(_INTL("¿Prefieres que {1} no aprenda {2}?",pkmnname,movename),&block)
Kernel.pbMessage(_INTL("{1} no ha aprendido {2}.",pkmnname,movename),&block)
return false
end
end
end
|
#pbLedge(xOffset, yOffset) ⇒ Object
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
|
# File 'scripts/PField_Field.rb', line 1256
def pbLedge(xOffset,yOffset)
if PBTerrain.isLedge?(Kernel.pbFacingTerrainTag)
if Kernel.pbJumpToward(2,true)
$scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true)
$game_player.increase_steps
$game_player.check_event_trigger_here([1,2])
end
return true
end
return false
end
|
#pbListScreen(title, lister) ⇒ Object
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
|
# File 'scripts/Editor.rb', line 1241
def pbListScreen(title,lister)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
list=pbListWindow([],256)
list.viewport=viewport
list.z=2
title=Window_UnformattedTextPokemon.new(title)
title.x=256
title.y=0
title.width=Graphics.width-256
title.height=64
title.viewport=viewport
title.z=2
lister.setViewport(viewport)
selectedmap=-1
commands=lister.commands
selindex=lister.startIndex
if commands.length==0
value=lister.value(-1)
lister.dispose
return value
end
list.commands=commands
list.index=selindex
loop do
Graphics.update
Input.update
list.update
if list.index!=selectedmap
lister.refresh(list.index)
selectedmap=list.index
end
if Input.trigger?(Input::C) || (list.doubleclick? rescue false)
break
elsif Input.trigger?(Input::B)
selectedmap=-1
break
end
end
value=lister.value(selectedmap)
lister.dispose
title.dispose
list.dispose
Input.update
return value
end
|
#pbListScreenBlock(title, lister) ⇒ Object
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
|
# File 'scripts/Editor.rb', line 1288
def pbListScreenBlock(title,lister)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
list=pbListWindow([],256)
list.viewport=viewport
list.z=2
title=Window_UnformattedTextPokemon.new(title)
title.x=256
title.y=0
title.width=Graphics.width-256
title.height=64
title.viewport=viewport
title.z=2
lister.setViewport(viewport)
selectedmap=-1
commands=lister.commands
selindex=lister.startIndex
if commands.length==0
value=lister.value(-1)
lister.dispose
return value
end
list.commands=commands
list.index=selindex
loop do
Graphics.update
Input.update
list.update
if list.index!=selectedmap
lister.refresh(list.index)
selectedmap=list.index
end
if Input.trigger?(Input::A)
yield(Input::A, lister.value(selectedmap))
list.commands=lister.commands
if list.index==list.commands.length
list.index=list.commands.length
end
lister.refresh(list.index)
elsif Input.trigger?(Input::C) || (list.doubleclick? rescue false)
yield(Input::C, lister.value(selectedmap))
list.commands=lister.commands
if list.index==list.commands.length
list.index=list.commands.length
end
lister.refresh(list.index)
elsif Input.trigger?(Input::B)
break
end
end
lister.dispose
title.dispose
list.dispose
Input.update
end
|
#pbListWindow(cmds, width = 256) ⇒ Object
964
965
966
967
968
969
970
971
|
# File 'scripts/Editor.rb', line 964
def pbListWindow(cmds,width=256)
list=Window_CommandPokemon.newWithSize(cmds,0,0,width,Graphics.height)
list.index=0
list.rowHeight=24
pbSetSmallFont(list.contents)
list.refresh
return list
end
|
#pbLittleCupRules(double) ⇒ Object
#pbLoadMessages(file) ⇒ Object
Manipulation methods for metadata, phone data and Pokémon species data
122
123
124
125
126
127
128
129
130
131
132
|
# File 'scripts/MiscData.rb', line 122
def pbLoadMetadata
$PokemonTemp=PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.pokemonMetadata
if !pbRgssExists?("Data/metadata.dat")
$PokemonTemp.pokemonMetadata=[]
else
$PokemonTemp.pokemonMetadata=load_data("Data/metadata.dat")
end
end
return $PokemonTemp.pokemonMetadata
end
|
#pbLoadPhoneData ⇒ Object
140
141
142
143
144
145
146
147
148
|
# File 'scripts/MiscData.rb', line 140
def pbLoadPhoneData
$PokemonTemp=PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.pokemonPhoneData
pbRgssOpen("Data/phone.dat","rb"){|f|
$PokemonTemp.pokemonPhoneData=Marshal.load(f)
}
end
return $PokemonTemp.pokemonPhoneData
end
|
#pbLoadRxData(file) ⇒ Object
11
12
13
14
15
16
17
|
# File 'scripts/PSystem_System.rb', line 11
def pbLoadRxData(file) if $RPGVX
return load_data(file+".rvdata")
else
return load_data(file+".rxdata")
end
end
|
#pbLoadTrainer(trainerid, trainername, partyid = 0) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 20
def pbLoadTrainer(trainerid,trainername,partyid=0)
if trainerid.is_a?(String) || trainerid.is_a?(Symbol)
if !hasConst?(PBTrainers,trainerid)
raise _INTL("El tipo de entrenador no existe ({1}, {2}, ID {3})",trainerid,trainername,partyid)
end
trainerid=getID(PBTrainers,trainerid)
end
success=false
items=[]
party=[]
opponent=nil
trainers=load_data("Data/trainers.dat")
for trainer in trainers
name=trainer[1]
thistrainerid=trainer[0]
thispartyid=trainer[4]
next if trainerid!=thistrainerid || name!=trainername || partyid!=thispartyid
items=trainer[2].clone
name=pbGetMessageFromHash(MessageTypes::TrainerNames,name)
for i in RIVALNAMES
if isConst?(trainerid,PBTrainers,i[0]) && $game_variables[i[1]]!=0
name=$game_variables[i[1]]
end
end
opponent=PokeBattle_Trainer.new(name,thistrainerid)
opponent.setForeignID($Trainer) if $Trainer
for poke in trainer[3]
species=poke[TPSPECIES]
level=poke[TPLEVEL]
pokemon=PokeBattle_Pokemon.new(species,level,opponent)
pokemon.formNoCall=poke[TPFORM]
pokemon.resetMoves
pokemon.setItem(poke[TPITEM])
if poke[TPMOVE1]>0 || poke[TPMOVE2]>0 || poke[TPMOVE3]>0 || poke[TPMOVE4]>0
k=0
for move in [TPMOVE1,TPMOVE2,TPMOVE3,TPMOVE4]
pokemon.moves[k]=PBMove.new(poke[move])
k+=1
end
pokemon.moves.compact!
end
pokemon.setAbility(poke[TPABILITY])
pokemon.setGender(poke[TPGENDER])
if poke[TPSHINY] pokemon.makeShiny
else
pokemon.makeNotShiny
end
pokemon.setNature(poke[TPNATURE])
iv=poke[TPIV]
for i in 0...6
pokemon.iv[i]=iv&0x1F
pokemon.ev[i]=[85,level*3/2].min
end
pokemon.happiness=poke[TPHAPPINESS]
pokemon.name=poke[TPNAME] if poke[TPNAME] && poke[TPNAME]!=""
if poke[TPSHADOW] pokemon.makeShadow rescue nil
pokemon.pbUpdateShadowMoves(true) rescue nil
pokemon.makeNotShiny
end
pokemon.ballused=poke[TPBALL]
pokemon.calcStats
party.push(pokemon)
end
success=true
break
end
return success ? [opponent,items,party] : nil
end
|
#pbLoadTrainerData(trainerid, trainername, partyid = 0) ⇒ Object
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
# File 'scripts/PScreen_Phone.rb', line 278
def pbLoadTrainerData(trainerid,trainername,partyid=0)
ret=nil
trainers=load_data("Data/trainers.dat")
for trainer in trainers
name=trainer[1]
thistrainerid=trainer[0]
thispartyid=trainer[4]
if trainerid==thistrainerid && name==trainername && partyid==thispartyid
ret=trainer
break
end
end
return ret
end
|
#pbLottery(winnum, nameVar = 2, positionVar = 3, matchedVar = 4) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'scripts/PMinigame_Lottery.rb', line 14
def pbLottery(winnum,nameVar=2,positionVar=3,matchedVar=4)
winnum=winnum.to_i
winpoke=nil
winpos=0
winmatched=0
for i in $Trainer.party
thismatched=0
id=i.publicID
for j in 0...5
if (id/(10**j))%10 == (winnum/(10**j))%10
thismatched+=1
else
break
end
end
if thismatched>winmatched
winpoke=i.name
winpos=1 winmatched=thismatched
end
end
pbEachPokemon{|poke,box|
thismatched=0
id=poke.publicID
for j in 0...5
if (id/(10**j))%10 == (winnum/(10**j))%10
thismatched+=1
else
break
end
end
if thismatched>winmatched
winpoke=poke.name
winpos=2 winmatched=thismatched
end
}
$game_variables[nameVar]=winpoke
$game_variables[positionVar]=winpos
$game_variables[matchedVar]=winmatched
end
|
#pbManageMysteryGifts ⇒ Object
Debug option for managing gifts in the Master file and exporting them to a file to be uploaded.
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'scripts/PScreen_MysteryGift.rb', line 143
def pbManageMysteryGifts
if !safeExists?("MysteryGiftMaster.txt")
Kernel.pbMessage(_INTL("No hay ningún Regalo Misterioso definido."))
return
end
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
if !master || !master.is_a?(Array) || master.length==0
Kernel.pbMessage(_INTL("No hay ningún Regalo Misterioso definido."))
return
end
msgwindow=Kernel.pbCreateMessageWindow
Kernel.pbMessageDisplay(msgwindow,_INTL("Buscando regalos en línea...\\wtnp[0]"))
online=pbDownloadToString(MYSTERYGIFTURL)
Kernel.pbDisposeMessageWindow(msgwindow)
if online==""
Kernel.pbMessage(_INTL("No se encontró ningún Regalo Misterioso en línea.\\wtnp[20]"))
online=[]
else
Kernel.pbMessage(_INTL("Regalo Misterioso en línea encontrado.\\wtnp[20]"))
online=pbMysteryGiftDecrypt(online)
t=[]
for gift in online; t.push(gift[0]); end
online=t
end
command=0
loop do
commands=pbRefreshMGCommands(master,online)
command=Kernel.pbMessage(_INTL("\\ts[]Gestionar Regalos Misteriosos (X=en línea)."),commands,-1,nil,command)
if command==-1 || command==commands.length-1
break
elsif command==commands.length-2
begin
newfile=[]
for gift in master
newfile.push(gift) if online.include?(gift[0])
end
string=pbMysteryGiftEncrypt(newfile)
File.open("MysteryGift.txt","wb"){|f|
f.write(string)
}
Kernel.pbMessage(_INTL("Los regalos se guardaron en MysteryGift.txt."))
Kernel.pbMessage(_INTL("MysteryGift.txt subido a Internet."))
rescue
Kernel.pbMessage(_INTL("No se pudieron guardar los regalos en MysteryGift.txt."))
end
elsif command>=0 && command<commands.length-2
cmd=0
loop do
commands=pbRefreshMGCommands(master,online)
gift=master[command]
cmds=[_INTL("Cambiar en/fuera de línea"),
_INTL("Editar"),
_INTL("Recibir"),
_INTL("Borrar"),
_INTL("Salir")]
cmd=Kernel.pbMessage("\\ts[]"+commands[command],cmds,-1,nil,cmd)
if cmd==-1 || cmd==cmds.length-1
break
elsif cmd==0 if online.include?(gift[0])
for i in 0...online.length
online[i]=nil if online[i]==gift[0]
end
online.compact!
else
online.push(gift[0])
end
elsif cmd==1 newgift=pbEditMysteryGift(gift[1],gift[2],gift[0],gift[3])
master[command]=newgift if newgift
elsif cmd==2 replaced=false
for i in 0...$Trainer.mysterygift.length
if $Trainer.mysterygift[i][0]==gift[0]
$Trainer.mysterygift[i]=gift; replaced=true
end
end
$Trainer.mysterygift.push(gift) if !replaced
pbReceiveMysteryGift(gift[0])
elsif cmd==3 if Kernel.pbConfirmMessage(_INTL("¿Estas seguro de querer borrar este regalo?"))
master[command]=nil
master.compact!
end
break
end
end
end
end
end
|
#pbMapInterpreter ⇒ Object
121
122
123
124
125
126
127
128
|
# File 'scripts/Messages.rb', line 121
def pbMapInterpreter
if $game_map && $game_map.respond_to?("interpreter")
return $game_map.interpreter
elsif $game_system
return $game_system.map_interpreter
end
return nil
end
|
#pbMapInterpreterRunning? ⇒ Boolean
116
117
118
119
|
# File 'scripts/Messages.rb', line 116
def pbMapInterpreterRunning?
interp=pbMapInterpreter
return interp && interp.running?
end
|
#pbMapTree ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'scripts/Debug.rb', line 90
def pbMapTree
mapinfos=pbLoadRxData("Data/MapInfos")
maplevels=[]
retarray=[]
for i in mapinfos.keys
info=mapinfos[i]
level=-1
while info
info=mapinfos[info.parent_id]
level+=1
end
if level>=0
info=mapinfos[i]
maplevels.push([i,level,info.parent_id,info.order])
end
end
maplevels.sort!{|a,b|
next a[1]<=>b[1] if a[1]!=b[1] next a[2]<=>b[2] if a[2]!=b[2] next a[3]<=>b[3] }
stack=[]
stack.push(0,0)
while stack.length>0
parent = stack[stack.length-1]
index = stack[stack.length-2]
if index>=maplevels.length
stack.pop
stack.pop
next
end
maplevel=maplevels[index]
stack[stack.length-2]+=1
if maplevel[2]!=parent
stack.pop
stack.pop
next
end
retarray.push([maplevel[0],mapinfos[maplevel[0]].name,maplevel[1]])
for i in index+1...maplevels.length
if maplevels[i][2]==maplevel[0]
stack.push(i)
stack.push(maplevel[0])
break
end
end
end
return retarray
end
|
#pbMEFade(x = 0.0) ⇒ Object
Fades out or stops ME playback. 'x' is the time in seconds to fade out.
122
|
# File 'scripts/AudioPlay.rb', line 122
def pbMEFade(x=0.0); pbMEStop(x);end
|
#pbMEPlay(param, volume = nil, pitch = nil) ⇒ Object
Plays an ME file. param – Either a string showing the filename (relative to Audio/ME/) or an RPG::AudioFile object. Possible formats for param: filename volume and pitch 100 filename:volume pitch 100 filename:volume:pitch volume – Volume of the file, up to 100 pitch – Pitch of the file, normally 100
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'scripts/AudioPlay.rb', line 104
def pbMEPlay(param,volume=nil,pitch=nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
if $game_system && $game_system.respond_to?("me_play")
$game_system.me_play(param)
return
elsif (RPG.const_defined?(:ME) rescue false)
b=RPG::ME.new(param.name,param.volume,param.pitch)
if b && b.respond_to?("play")
b.play; return
end
end
Audio.me_play(canonicalize("Audio/ME/"+param.name),param.volume,param.pitch)
end
end
|
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
|
# File 'scripts/Messages.rb', line 1248
def pbMessageWaitForInput(msgwindow,frames,showPause=false)
return if !frames || frames<=0
if msgwindow && showPause
msgwindow.startPause
end
frames.times do
Graphics.update
Input.update
msgwindow.update if msgwindow
pbUpdateSceneMap
if Input.trigger?(Input::C) || Input.trigger?(Input::B)
break
end
yield if block_given?
end
if msgwindow && showPause
msgwindow.stopPause
end
end
|
#pbMEStop(timeInSeconds = 0.0) ⇒ Object
Fades out or stops ME playback. 'x' is the time in seconds to fade out.
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'scripts/AudioPlay.rb', line 125
def pbMEStop(timeInSeconds=0.0)
if $game_system && timeInSeconds>0.0 && $game_system.respond_to?("me_fade")
$game_system.me_fade(timeInSeconds)
return
elsif $game_system && $game_system.respond_to?("me_stop")
$game_system.me_stop(nil)
return
elsif (RPG.const_defined?(:ME) rescue false)
begin
(timeInSeconds>0.0) ? RPG::ME.fade((timeInSeconds*1000).floor) : RPG::ME.stop
return
rescue
end
end
(timeInSeconds>0.0) ? Audio.me_fade((timeInSeconds*1000).floor) : Audio.me_stop
end
|
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
|
# File 'scripts/Editor.rb', line 3207
def pbMetadataScreen(defaultMapId=nil)
metadata=nil
mapinfos=pbLoadRxData("Data/MapInfos")
metadata=load_data("Data/metadata.dat")
map=defaultMapId ? defaultMapId : 0
loop do
map=pbListScreen(_INTL("SETEAR METADATOS"),MapLister.new(map,true))
break if map<0
mapname=(map==0) ? _INTL("Metadatos Globales") : mapinfos[map].name
data=[]
properties=(map==0) ? MapScreenScene::GLOBALMETADATA :
MapScreenScene::LOCALMAPS
for i in 0...properties.length
data.push(metadata[map] ? metadata[map][i+1] : nil)
end
pbPropertyList(mapname,data,properties)
for i in 0...properties.length
if !metadata[map]
metadata[map]=[]
end
metadata[map][i+1]=data[i]
end
end
pbSerializeMetadata(metadata,mapinfos) if metadata
end
|
#pbMiniCheckEvolution(pokemon, evonib, level, poke) ⇒ Object
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
|
# File 'scripts/Pokemon_Evolution.rb', line 1032
def pbMiniCheckEvolution(pokemon,evonib,level,poke)
case evonib
when PBEvolution::Happiness
return poke if pokemon.happiness>=220
when PBEvolution::HappinessForm0
return poke if pokemon.happiness>=220 && pokemon.form==0
when PBEvolution::HappinessForm1
return poke if pokemon.happiness>=220 && pokemon.form==1
when PBEvolution::HappinessForm2
return poke if pokemon.happiness>=220 && pokemon.form==2
when PBEvolution::HappinessDay
return poke if pokemon.happiness>=220 && PBDayNight.isDay?
when PBEvolution::HappinessNight
if isConst?(pokemon.species,PBSpecies,:KUBFU)
pokemon.form=1 if pokemon.happiness>=220 && PBDayNight.isNight?
end
return poke if pokemon.happiness>=220 && PBDayNight.isNight?
when PBEvolution::HappinessMoveType
if pokemon.happiness>=220
for i in 0...4
return poke if pokemon.moves[i].id>0 && pokemon.moves[i].type==level
end
end
when PBEvolution::Level
if isConst?(pokemon.species,PBSpecies,:CUBONE) && pokemon.obtainMap==22 && PBDayNight.isNight?
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:KOFFING) && pokemon.obtainMap==32
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:QUILAVA) && pokemon.obtainMap==33
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:DEWOTT) && pokemon.obtainMap==33
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:DARTRIX) && pokemon.obtainMap==33
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:RUFFLET) && pokemon.obtainMap==33
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:GOOMY) && pokemon.obtainMap==33
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:BERGMITE) && pokemon.obtainMap==33
pokemon.form=1 if level>=level
elsif isConst?(pokemon.species,PBSpecies,:TOXEL) && (pokemon.nature==PBNatures::LONELY ||
pokemon.nature==PBNatures::BOLD || pokemon.nature==PBNatures::RELAXED ||
pokemon.nature==PBNatures::TIMID || pokemon.nature==PBNatures::SERIOUS ||
pokemon.nature==PBNatures::MODEST || pokemon.nature==PBNatures::MILD ||
pokemon.nature==PBNatures::QUIET || pokemon.nature==PBNatures::BASHFUL ||
pokemon.nature==PBNatures::CALM || pokemon.nature==PBNatures::GENTLE ||
pokemon.nature==PBNatures::CAREFUL)
pokemon.form=1 if level>=level
end
return poke if pokemon.level>=level
when PBEvolution::LevelForm0
return poke if pokemon.level>=level && pokemon.form==0
when PBEvolution::LevelForm1
return poke if pokemon.level>=level && pokemon.form==1
when PBEvolution::LevelForm2
return poke if pokemon.level>=level && pokemon.form==2
when PBEvolution::LevelDay
return poke if pokemon.level>=level && PBDayNight.isDay?
when PBEvolution::LevelDayForm0
return poke if pokemon.level>=level && pokemon.form==0 && PBDayNight.isDay?
when PBEvolution::LevelDayForm1
return poke if pokemon.level>=level && pokemon.form==1 && PBDayNight.isDay?
when PBEvolution::LevelDayForm2
return poke if pokemon.level>=level && pokemon.form==2 && PBDayNight.isDay?
when PBEvolution::LevelNight
return poke if pokemon.level>=level && PBDayNight.isNight?
when PBEvolution::LevelNightForm0
return poke if pokemon.level>=level && pokemon.form==0 && PBDayNight.isNight?
when PBEvolution::LevelNightForm1
return poke if pokemon.level>=level && pokemon.form==1 && PBDayNight.isNight?
when PBEvolution::LevelNightForm2
return poke if pokemon.level>=level && pokemon.form==2 && PBDayNight.isNight?
when PBEvolution::LevelMale
return poke if pokemon.level>=level && pokemon.isMale?
when PBEvolution::LevelFemale
return poke if pokemon.level>=level && pokemon.isFemale?
when PBEvolution::AttackGreater return poke if pokemon.level>=level && pokemon.attack>pokemon.defense
when PBEvolution::AtkDefEqual return poke if pokemon.level>=level && pokemon.attack==pokemon.defense
when PBEvolution::DefenseGreater return poke if pokemon.level>=level && pokemon.attack<pokemon.defense
when PBEvolution::Silcoon
return poke if pokemon.level>=level && (((pokemon.personalID>>16)&0xFFFF)%10)<5
when PBEvolution::Cascoon
return poke if pokemon.level>=level && (((pokemon.personalID>>16)&0xFFFF)%10)>=5
when PBEvolution::Ninjask
return poke if pokemon.level>=level
when PBEvolution::Shedinja
return -1
when PBEvolution::DayHoldItem
return poke if pokemon.item==level && PBDayNight.isDay?
when PBEvolution::NightHoldItem
return poke if pokemon.item==level && PBDayNight.isNight?
when PBEvolution::HoldItemForm0
return poke if pokemon.item==level && pokemon.form==0
when PBEvolution::HoldItemForm1
return poke if pokemon.item==level && pokemon.form==1
when PBEvolution::HoldItemForm2
return poke if pokemon.item==level && pokemon.form==2
when PBEvolution::HasMove
for i in 0...4
if isConst?(pokemon.species,PBSpecies,:MIMEJR) && pokemon.obtainMap==32
pokemon.form=1 if pokemon.moves[i].id==level
end
return poke if pokemon.moves[i].id==level
end
when PBEvolution::HasMoveForm0
for i in 0...4
return poke if pokemon.moves[i].id==level && pokemon.form==0
end
when PBEvolution::HasMoveForm1
for i in 0...4
return poke if pokemon.moves[i].id==level && pokemon.form==1
end
when PBEvolution::HasMoveForm2
for i in 0...4
return poke if pokemon.moves[i].id==level && pokemon.form==2
end
when PBEvolution::HasInParty
for i in $Trainer.party
return poke if !i.isEgg? && i.species==level
end
when PBEvolution::LevelDarkInParty
if pokemon.level>=level
for i in $Trainer.party
return poke if !i.isEgg? && i.hasType?(:DARK)
end
end
when PBEvolution::Location
return poke if $game_map.map_id==level
when PBEvolution::LevelRain
if pokemon.level>=level
if $game_screen && ($game_screen.weather==PBFieldWeather::Rain ||
$game_screen.weather==PBFieldWeather::HeavyRain ||
$game_screen.weather==PBFieldWeather::Storm)
return poke
end
end
when PBEvolution::Beauty return poke if pokemon.beauty>=level
when PBEvolution::Trade, PBEvolution::TradeItem, PBEvolution::TradeSpecies
return -1
when PBEvolution::LevelDayTime if PBDayNight.isDusk?
pokemon.form=2
if pokemon.level>=level
return poke
else
if PBDayNight.isDay?
pokemon.form=0
return poke if pokemon.level>=level
else
pokemon.form=1
return poke if pokemon.level>=level
end
end
end
if PBDayNight.isNight?
pokemon.form=1
return poke if pokemon.level>=level && PBDayNight.isNight?
end
if PBDayNight.isDay?
pokemon.form=0
return poke if pokemon.level>=level && PBDayNight.isDay?
end
when PBEvolution::Crits return poke if $criticosFarf>=3 && pokemon.form==1
end
return -1
end
|
#pbMiniCheckEvolutionItem(pokemon, evonib, level, poke, item) ⇒ Object
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
|
# File 'scripts/Pokemon_Evolution.rb', line 1204
def pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)
case evonib
when PBEvolution::Item
if isConst?(pokemon.species,PBSpecies,:PIKACHU) && pokemon.obtainMap==22
pokemon.form=1 if level==item
elsif isConst?(pokemon.species,PBSpecies,:EXEGGCUTE) && pokemon.obtainMap==22
pokemon.form=1 if level==item
elsif isConst?(pokemon.species,PBSpecies,:PETILIL) && pokemon.obtainMap==33
pokemon.form=1 if level==item
end
return poke if level==item
when PBEvolution::ItemMale
return poke if level==item && pokemon.isMale?
when PBEvolution::ItemFemale
return poke if level==item && pokemon.isFemale?
when PBEvolution::ItemForm0
return poke if level==item && pokemon.form==0
when PBEvolution::ItemForm1
return poke if level==item && pokemon.form==1
when PBEvolution::ItemForm2
return poke if level==item && pokemon.form==2
end
return -1
end
|
#pbMiningGame ⇒ Object
600
601
602
603
604
605
606
|
# File 'scripts/PMinigame_Mining.rb', line 600
def pbMiningGame
scene=MiningGameScene.new
screen=MiningGame.new(scene)
pbFadeOutIn(99999) {
screen.pbStartScreen
}
end
|
#pbMissingTrainer(trainerid, trainername, trainerparty) ⇒ Object
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 198
def pbMissingTrainer(trainerid, trainername, trainerparty)
if trainerid.is_a?(String) || trainerid.is_a?(Symbol)
if !hasConst?(PBTrainers,trainerid)
raise _INTL("El tipo de entrenador no existe ({1}, {2}, ID {3})",trainerid,trainername,partyid)
end
trainerid=getID(PBTrainers,trainerid)
end
traineridstring="#{trainerid}"
traineridstring=getConstantName(PBTrainers,trainerid) rescue "-"
if $DEBUG
message=""
if trainerparty!=0
message=(_INTL("¿Agregar entrenador nuevo ({1}, {2}, ID {3})?",traineridstring,trainername,trainerparty))
else
message=(_INTL("¿Agregar entrenador nuevo ({1}, {2})?",traineridstring,trainername))
end
cmd=Kernel.pbMessage(message,[_INTL("Sí"),_INTL("No")],2)
if cmd==0
pbNewTrainer(trainerid,trainername,trainerparty)
end
return cmd
else
raise _INTL("No se encontró entrenador ({1}, {2}, ID {3})",traineridstring,trainername,trainerparty)
end
end
|
#pbMoveRoute(event, commands, waitComplete = false) ⇒ Object
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
|
# File 'scripts/PField_Field.rb', line 2445
def pbMoveRoute(event,commands,waitComplete=false)
route=RPG::MoveRoute.new
route.repeat=false
route.skippable=true
route.list.clear
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOn))
i=0; while i<commands.length
case commands[i]
when PBMoveRoute::Wait, PBMoveRoute::SwitchOn, PBMoveRoute::SwitchOff,
PBMoveRoute::ChangeSpeed, PBMoveRoute::ChangeFreq, PBMoveRoute::Opacity,
PBMoveRoute::Blending, PBMoveRoute::PlaySE, PBMoveRoute::Script
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1]]))
i+=1
when PBMoveRoute::ScriptAsync
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Script,[commands[i+1]]))
route.list.push(RPG::MoveCommand.new(PBMoveRoute::Wait,[0]))
i+=1
when PBMoveRoute::Jump
route.list.push(RPG::MoveCommand.new(commands[i],[commands[i+1],commands[i+2]]))
i+=2
when PBMoveRoute::Graphic
route.list.push(RPG::MoveCommand.new(commands[i],
[commands[i+1],commands[i+2],commands[i+3],commands[i+4]]))
i+=4
else
route.list.push(RPG::MoveCommand.new(commands[i]))
end
i+=1
end
route.list.push(RPG::MoveCommand.new(PBMoveRoute::ThroughOff))
route.list.push(RPG::MoveCommand.new(0))
if event
event.force_move_route(route)
end
return route
end
|
#pbMoveToMailbox(pokemon) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'scripts/PItem_Mail.rb', line 17
def pbMoveToMailbox(pokemon)
$PokemonGlobal.mailbox=[] if !$PokemonGlobal.mailbox
return false if $PokemonGlobal.mailbox.length>=10
return false if !pokemon.mail
$PokemonGlobal.mailbox.push(pokemon.mail)
pokemon.mail=nil
return true
end
|
#pbMysteryGiftDecrypt(gift) ⇒ Object
361
362
363
364
365
|
# File 'scripts/PScreen_MysteryGift.rb', line 361
def pbMysteryGiftDecrypt(gift)
return [] if gift==""
ret=Marshal.restore(Zlib::Inflate.inflate(gift.unpack("m")[0]))
return ret
end
|
#pbMysteryGiftEncrypt(gift) ⇒ Object
Converts an array of gifts into a string and back.
356
357
358
359
|
# File 'scripts/PScreen_MysteryGift.rb', line 356
def pbMysteryGiftEncrypt(gift)
ret=[Zlib::Deflate.deflate(Marshal.dump(gift))].pack("m")
return ret
end
|
#pbNarrowFontName ⇒ Object
Gets the name of the system narrow font.
1479
1480
1481
1482
|
# File 'scripts/SpriteWindow.rb', line 1479
def pbNarrowFontName()
return MessageConfig.pbTryFonts("Power Green Narrow","Pokemon Emerald Narrow",
"Arial Narrow","Arial")
end
|
#pbNewBattleScene ⇒ Object
469
470
471
|
# File 'scripts/PField_Field.rb', line 469
def pbNewBattleScene
return PokeBattle_Scene.new
end
|
#pbNewEncounterType(enc) ⇒ Object
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
|
# File 'scripts/Editor.rb', line 2232
def pbNewEncounterType(enc)
cmdwin=pbListWindow([])
commands=[]
indexes=[]
for i in 0...EncounterTypes::EnctypeChances.length
dogen=false
if !enc[1][i]
if i==0
dogen=true unless enc[1][EncounterTypes::Cave]
elsif i==1
dogen=true unless enc[1][EncounterTypes::Land] ||
enc[1][EncounterTypes::LandMorning] ||
enc[1][EncounterTypes::LandDay] ||
enc[1][EncounterTypes::LandNight] ||
enc[1][EncounterTypes::BugContest]
else
dogen=true
end
end
if dogen
commands.push(EncounterTypes::Names[i])
indexes.push(i)
end
end
ret=pbCommands2(cmdwin,commands,-1)
ret=(ret<0) ? -1 : indexes[ret]
if ret>=0
chances=EncounterTypes::EnctypeChances[ret]
enc[1][ret]=[]
for i in 0...chances.length
enc[1][ret].push([1,5,5])
end
end
cmdwin.dispose
return ret
end
|
#pbNewTrainer(trainerid, trainername, trainerparty) ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 105
def pbNewTrainer(trainerid,trainername,trainerparty)
pokemon=[]
level=TPDEFAULTS[TPLEVEL]
for i in 1..6
if i==1
Kernel.pbMessage(_INTL("Ingrese el primer Pokémon.",i))
else
break if !Kernel.pbConfirmMessage(_INTL("¿Agregar otro Pokémon?"))
end
loop do
species=pbChooseSpeciesOrdered(1)
if species<=0
if i==1
Kernel.pbMessage(_INTL("¡Este entrenador debe tener al menos 1 Pokémon!"))
else
break
end
else
params=ChooseNumberParams.new
params.setRange(1,PBExperience::MAXLEVEL)
params.setDefaultValue(level)
level=Kernel.pbMessageChooseNumber(_INTL("Establecer el nivel de {1}.",
PBSpecies.getName(species)),params)
tempPoke=PokeBattle_Pokemon.new(species,level)
pokemon.push([species,level,0,
tempPoke.moves[0].id,
tempPoke.moves[1].id,
tempPoke.moves[2].id,
tempPoke.moves[3].id
])
break
end
end
end
trainer=[trainerid,trainername,[],pokemon,trainerparty]
data=load_data("Data/trainers.dat")
data.push(trainer)
data=save_data(data,"Data/trainers.dat")
pbConvertTrainerData
Kernel.pbMessage(_INTL("Los datos del entrenador han sido agregados a la lista de combates y en PBS/trainers.txt."))
return trainer
end
|
#pbNextMysteryGiftID ⇒ Object
Collecting a Mystery Gift from the deliveryman.
372
373
374
375
376
377
|
# File 'scripts/PScreen_MysteryGift.rb', line 372
def pbNextMysteryGiftID
for i in $Trainer.mysterygift
return i[0] if i.length>1
end
return 0
end
|
#pbOpenDexData ⇒ Object
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# File 'scripts/MiscData.rb', line 150
def pbOpenDexData
$PokemonTemp=PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.pokemonDexData
pbRgssOpen("Data/dexdata.dat","rb"){|f|
$PokemonTemp.pokemonDexData=f.read
}
end
if block_given?
StringInput.open($PokemonTemp.pokemonDexData) {|f| yield f }
else
return StringInput.open($PokemonTemp.pokemonDexData)
end
end
|
#pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin) ⇒ Object
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
|
# File 'scripts/PBattle_OrgBattle.rb', line 973
def pbOrganizedBattleEx(opponent,challengedata,endspeech,endspeechwin)
if !challengedata
challengedata=PokemonChallengeRules.new
end
scene=pbNewBattleScene
for i in 0...$Trainer.party.length
$Trainer.party[i].heal
end
olditems=$Trainer.party.transform{|p| p.item }
olditems2=$Trainer.party.transform{|p| p.item }
battle=challengedata.createBattle(scene,$Trainer,opponent)
battle.internalbattle=false
battle.endspeech=endspeech
battle.endspeechwin=endspeechwin
if Input.press?(Input::CTRL) && $DEBUG
Kernel.pbMessage(_INTL("SALTANDO BATALLA..."))
Kernel.pbMessage(_INTL("TRAS PERDER..."))
Kernel.pbMessage(battle.endspeech)
$PokemonTemp.lastbattle=nil
return true
end
oldlevels=challengedata.adjustLevels($Trainer.party,opponent.party)
pbPrepareBattle(battle)
decision=0
trainerbgm=pbGetTrainerBattleBGM(opponent)
pbBattleAnimation(trainerbgm) {
pbSceneStandby {
decision=battle.pbStartBattle
}
}
challengedata.unadjustLevels($Trainer.party,opponent.party,oldlevels)
for i in 0...$Trainer.party.length
$Trainer.party[i].heal
$Trainer.party[i].setItem(olditems[i])
end
for i in 0...opponent.party.length
opponent.party[i].heal
opponent.party[i].setItem(olditems2[i])
end
Input.update
if decision==1||decision==2||decision==5
$PokemonTemp.lastbattle=battle.pbDumpRecord
else
$PokemonTemp.lastbattle=nil
end
return (decision==1)
end
|
#pbPCItemStorage ⇒ Object
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
|
# File 'scripts/PScreen_Storage.rb', line 2887
def pbPCItemStorage
loop do
command=Kernel.pbShowCommandsWithHelp(nil,
[_INTL("Sacar Objeto"),
_INTL("Dejar Objeto"),
_INTL("Tirar Objeto"),
_INTL("Salir")],
[_INTL("Sacar objetos de la PC."),
_INTL("Almacenar objetos en la PC."),
_INTL("Tirar objetos almacenados en la PC."),
_INTL("Volver al menú anterior.")],-1
)
if command==0 if !$PokemonGlobal.pcItemStorage
$PokemonGlobal.pcItemStorage=PCItemStorage.new
end
if $PokemonGlobal.pcItemStorage.empty?
Kernel.pbMessage(_INTL("No hay objetos."))
else
pbFadeOutIn(99999){
scene=WithdrawItemScene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
ret=screen.pbWithdrawItemScreen
}
end
elsif command==1 pbFadeOutIn(99999){
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
ret=screen.pbDepositItemScreen
}
elsif command==2 if !$PokemonGlobal.pcItemStorage
$PokemonGlobal.pcItemStorage=PCItemStorage.new
end
if $PokemonGlobal.pcItemStorage.empty?
Kernel.pbMessage(_INTL("No hay objetos."))
else
pbFadeOutIn(99999){
scene=TossItemScene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
ret=screen.pbTossItemScreen
}
end
else
break
end
end
end
|
#pbPCMailbox ⇒ Object
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
|
# File 'scripts/PScreen_Storage.rb', line 2937
def pbPCMailbox
if !$PokemonGlobal.mailbox || $PokemonGlobal.mailbox.length==0
Kernel.pbMessage(_INTL("Aquí no hay ninguna Carta."))
else
loop do
commands=[]
for mail in $PokemonGlobal.mailbox
commands.push(mail.sender)
end
commands.push(_INTL("Salir"))
command=Kernel.pbShowCommands(nil,commands,-1)
if command>=0 && command<$PokemonGlobal.mailbox.length
mailIndex=command
command=Kernel.pbMessage(_INTL("¿Qué quieres hacer con la Carta de {1}?",
$PokemonGlobal.mailbox[mailIndex].sender),[
_INTL("Leer"),
_INTL("Mover a la Mochila"),
_INTL("Dar"),
_INTL("Salir")
],-1)
if command==0 pbFadeOutIn(99999){
pbDisplayMail($PokemonGlobal.mailbox[mailIndex])
}
elsif command==1 if Kernel.pbConfirmMessage(_INTL("El mensaje se perderá. ¿Estás de acuerdo?"))
if $PokemonBag.pbStoreItem($PokemonGlobal.mailbox[mailIndex].item)
Kernel.pbMessage(_INTL("La Carta regresó a la Mochila con el mensaje borrado."))
$PokemonGlobal.mailbox.delete_at(mailIndex)
else
Kernel.pbMessage(_INTL("La mochila está llena."))
end
end
elsif command==2 pbFadeOutIn(99999){
sscene=PokemonScreen_Scene.new
sscreen=PokemonScreen.new(sscene,$Trainer.party)
sscreen.pbPokemonGiveMailScreen(mailIndex)
}
end
else
break
end
end
end
end
|
#pbPhoneBattleCount(trtype, trname) ⇒ Object
114
115
116
117
118
119
120
|
# File 'scripts/PScreen_Phone.rb', line 114
def pbPhoneBattleCount(trtype,trname)
trainer=pbFindPhoneTrainer(trtype,trname)
if trainer
return trainer[5]
end
return 0
end
|
#pbPhoneCall(call, phonenum) ⇒ Object
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
|
# File 'scripts/PScreen_Phone.rb', line 462
def pbPhoneCall(call,phonenum)
Kernel.pbMessage(_INTL("......\\wt[5] ......\\1"))
encspecies=pbEncounterSpecies(phonenum)
trainerspecies=pbTrainerSpecies(phonenum)
trainermap=pbTrainerMapName(phonenum)
messages=call.split("\\m")
for i in 0...messages.length
messages[i].gsub!(/\\TN/,phonenum[2])
messages[i].gsub!(/\\TP/,trainerspecies)
messages[i].gsub!(/\\TE/,encspecies)
messages[i].gsub!(/\\TM/,trainermap)
if i<messages.length-1
messages[i]+="\\1"
end
Kernel.pbMessage(messages[i])
end
Kernel.pbMessage(_INTL("¡Clic!\\wt[10]\n......\\wt[5] ......\\1"))
end
|
78
79
80
81
82
83
84
|
# File 'scripts/PScreen_Phone.rb', line 78
def pbPhoneDeleteContact(index)
$PokemonGlobal.phoneNumbers[index][0]=false if $PokemonGlobal.phoneNumbers[index].length==8
$PokemonGlobal.phoneNumbers[index][3]=0 $PokemonGlobal.phoneNumbers[index][4]=0 end
end
|
#pbPhoneGenerateCall(phonenum) ⇒ Object
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# File 'scripts/PScreen_Phone.rb', line 222
def pbPhoneGenerateCall(phonenum)
call=""
phoneData=pbLoadPhoneData
call=pbRandomPhoneItem(phoneData.greetings)
time=pbGetTimeNow
if PBDayNight.isMorning?(time)
modcall=pbRandomPhoneItem(phoneData.greetingsMorning)
call=modcall if modcall && modcall!=""
elsif PBDayNight.isEvening?(time)
modcall=pbRandomPhoneItem(phoneData.greetingsEvening)
call=modcall if modcall && modcall!=""
end
call+="\\m"
if phonenum[4]==2 || (rand(2)==0 && phonenum[4]==3)
call+=pbRandomPhoneItem(phoneData.battleRequests)
pbSetReadyToBattle(phonenum)
phonenum[4]=3
elsif rand(4)<3
call+=pbRandomPhoneItem(phoneData.bodies1)
call+="\\m"
call+=pbRandomPhoneItem(phoneData.bodies2)
else
call+=pbRandomPhoneItem(phoneData.generics)
end
return call
end
|
#pbPhoneIncrement(trtype, trname, maxbattles) ⇒ Object
122
123
124
125
126
127
128
129
130
131
|
# File 'scripts/PScreen_Phone.rb', line 122
def pbPhoneIncrement(trtype,trname,maxbattles)
trainer=pbFindPhoneTrainer(trtype,trname)
if trainer
if trainer[5]<maxbattles
trainer[5]+=1 end
trainer[3]=0 trainer[4]=0 end
end
|
#pbPhoneReadyToBattle?(trtype, trname) ⇒ Boolean
106
107
108
109
110
111
112
|
# File 'scripts/PScreen_Phone.rb', line 106
def pbPhoneReadyToBattle?(trtype,trname)
trainer=pbFindPhoneTrainer(trtype,trname)
if trainer
return (trainer[4]>=2)
end
return false
end
|
#pbPhoneRegister(event, trainertype, trainername) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'scripts/PScreen_Phone.rb', line 59
def pbPhoneRegister(event,trainertype,trainername)
if !$PokemonGlobal.phoneNumbers
$PokemonGlobal.phoneNumbers=[]
end
return if pbFindPhoneTrainer(trainertype,trainername)
phonenum=[]
phonenum.push(true)
phonenum.push(trainertype)
phonenum.push(trainername)
phonenum.push(0) phonenum.push(0) phonenum.push(0) if event
phonenum.push(event.map.map_id)
phonenum.push(event.id)
end
$PokemonGlobal.phoneNumbers.push(phonenum)
end
|
#pbPhoneRegisterBattle(message, event, trainertype, trainername, maxbattles) ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'scripts/PScreen_Phone.rb', line 86
def pbPhoneRegisterBattle(message,event,trainertype,trainername,maxbattles)
return if !$Trainer.pokegear contact=pbFindPhoneTrainer(trainertype,trainername)
return if contact && contact[0] message=_INTL("Déjame registrarte.") if !message
if Kernel.pbConfirmMessage(message)
displayname=_INTL("{1} {2}",
PBTrainers.getName(trainertype),
pbGetMessageFromHash(MessageTypes::TrainerNames,trainername)
)
if contact contact[0]=true
else pbPhoneRegister(event,trainertype,trainername)
pbPhoneIncrement(trainertype,trainername,maxbattles)
end
Kernel.pbMessage(_INTL("Se registró a {1} en el Pokégear.",displayname))
end
end
|
#pbPhoneRegisterNPC(ident, name, mapid, showmessage = true) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'scripts/PScreen_Phone.rb', line 37
def pbPhoneRegisterNPC(ident,name,mapid,showmessage=true)
if !$PokemonGlobal.phoneNumbers
$PokemonGlobal.phoneNumbers=[]
end
exists=pbFindPhoneTrainer(ident,name)
if exists
if exists[0] return
else
exists[0]=true end
else
phonenum=[]
phonenum.push(true) phonenum.push(ident) phonenum.push(name) phonenum.push(mapid) end
$PokemonGlobal.phoneNumbers.push(phonenum)
Kernel.pbMessage(_INTL("Se registró a {1} en el Pokégear.",name)) if showmessage
end
|
#pbPhoneReset(trtype, trname) ⇒ Object
133
134
135
136
137
138
139
140
141
|
# File 'scripts/PScreen_Phone.rb', line 133
def pbPhoneReset(trtype,trname)
trainer=pbFindPhoneTrainer(trtype,trname)
if trainer
trainer[3]=0 trainer[4]=0 return true
end
return false
end
|
#pbPickBerry(berry, qty = 1) ⇒ Object
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
# File 'scripts/PField_BerryPlants.rb', line 540
def pbPickBerry(berry,qty=1)
interp=pbMapInterpreter
thisEvent=interp.get_character(0)
berryData=interp.getVariable
if berry.is_a?(String) || berry.is_a?(Symbol)
berry=getID(PBItems,berry)
end
itemname=(qty>1) ? PBItems.getNamePlural(berry) : PBItems.getName(berry)
if qty>1
message=_INTL("¡El arbusto de {2} ha dado {1} bayas!\n¿Quieres cosecharlas?",qty,itemname)
else
message=_INTL("¡El arbusto de {1} ha dado una baya!\n¿Quieres cosecharlas?",itemname)
end
if Kernel.pbConfirmMessage(message)
if !$PokemonBag.pbCanStore?(berry,qty)
Kernel.pbMessage(_INTL("Malísimo...\nLa Mochila está llena."))
return
end
$PokemonBag.pbStoreItem(berry,qty)
pocket=pbGetPocket(berry)
if qty>1
Kernel.pbMessage(_INTL("Has cosechado {1} bayas del arbusto de {2}.\\wtnp[30]",qty,itemname))
else
Kernel.pbMessage(_INTL("Has cosechado una baya del arbusto de {1}.\\wtnp[30]",itemname))
end
Kernel.pbMessage(_INTL("{1} ha metido la cosecha de {2} en el Bolsillo de <icon=bagPocket#{pocket}>\\c[1]Bayas\\c[0] de la Mochila.\1",
$Trainer.name,itemname))
if NEWBERRYPLANTS
Kernel.pbMessage(_INTL("El suelo se ha vuelto blando y fértil de nuevo.\1"))
berryData=[0,0,0,0,0,0,0,0]
else
Kernel.pbMessage(_INTL("El suelo se ha vuelto blando y fértil de nuevo.\1"))
berryData=[0,0,false,0,0,0]
end
interp.setVariable(berryData)
pbSetSelfSwitch(thisEvent.id,"A",true)
end
end
|
#pbPikaCupRules(double) ⇒ Object
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 1309
def pbPikaCupRules(double)
ret=PokemonChallengeRules.new
ret.addPokemonRule(StandardRestriction.new)
ret.addLevelRule(15,20,50)
ret.addTeamRule(SpeciesClause.new)
ret.addTeamRule(ItemClause.new)
ret.addBattleRule(SleepClause.new)
ret.addBattleRule(FreezeClause.new)
ret.addBattleRule(SelfKOClause.new)
ret.setDoubleBattle(double).setNumber(3)
return ret
end
|
#pbPlayBattle(battledata) ⇒ Object
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
|
# File 'scripts/PBattle_OrgBattle.rb', line 651
def pbPlayBattle(battledata)
if battledata
scene=pbNewBattleScene
scene.abortable=true
lastbattle=Marshal.restore(StringInput.new(battledata))
case lastbattle[0]
when BattleChallenge::BattleTower
battleplayer=PokeBattle_BattlePlayer.new(scene,lastbattle)
when BattleChallenge::BattlePalace
battleplayer=PokeBattle_BattlePalacePlayer.new(scene,lastbattle)
when BattleChallenge::BattleArena
battleplayer=PokeBattle_BattleArenaPlayer.new(scene,lastbattle)
end
bgm=BattlePlayerHelper.pbGetBattleBGM(lastbattle)
pbBattleAnimation(bgm) {
pbSceneStandby {
decision=battleplayer.pbStartBattle
}
}
end
end
|
#pbPlayBattleFromFile(filename) ⇒ Object
688
689
690
691
692
|
# File 'scripts/PBattle_OrgBattle.rb', line 688
def pbPlayBattleFromFile(filename)
pbRgssOpen(filename,"rb"){|f|
pbPlayBattle(f.read)
}
end
|
#pbPlayBuzzerSE ⇒ Object
Plays a buzzer sound effect.
275
276
277
278
279
280
281
282
283
284
285
|
# File 'scripts/AudioPlay.rb', line 275
def pbPlayBuzzerSE()
if $data_system && $data_system.respond_to?("buzzer_se") &&
$data_system.buzzer_se && $data_system.buzzer_se.name!=""
pbSEPlay($data_system.buzzer_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name!=""
pbSEPlay($data_system.sounds[3])
elsif FileTest.audio_exist?("Audio/SE/buzzer")
pbSEPlay("buzzer",80)
end
end
|
#pbPlayCancelSE ⇒ Object
Plays a sound effect that plays when a choice is canceled.
262
263
264
265
266
267
268
269
270
271
272
|
# File 'scripts/AudioPlay.rb', line 262
def pbPlayCancelSE()
if $data_system && $data_system.respond_to?("cancel_se") &&
$data_system.cancel_se && $data_system.cancel_se.name!=""
pbSEPlay($data_system.cancel_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[2] && $data_system.sounds[2].name!=""
pbSEPlay($data_system.sounds[2])
elsif FileTest.audio_exist?("Audio/SE/Choose")
pbSEPlay("Choose",80)
end
end
|
#pbPlayCursorSE ⇒ Object
Plays a sound effect that plays when the player moves the cursor.
236
237
238
239
240
241
242
243
244
245
246
|
# File 'scripts/AudioPlay.rb', line 236
def pbPlayCursorSE()
if $data_system && $data_system.respond_to?("cursor_se") &&
$data_system.cursor_se && $data_system.cursor_se.name!=""
pbSEPlay($data_system.cursor_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[0] && $data_system.sounds[0].name!=""
pbSEPlay($data_system.sounds[0])
elsif FileTest.audio_exist?("Audio/SE/Choose")
pbSEPlay("Choose",80)
end
end
|
#pbPlayDecisionSE ⇒ Object
Plays a sound effect that plays when a decision is confirmed or a choice is made.
249
250
251
252
253
254
255
256
257
258
259
|
# File 'scripts/AudioPlay.rb', line 249
def pbPlayDecisionSE()
if $data_system && $data_system.respond_to?("decision_se") &&
$data_system.decision_se && $data_system.decision_se.name!=""
pbSEPlay($data_system.decision_se)
elsif $data_system && $data_system.respond_to?("sounds") &&
$data_system.sounds && $data_system.sounds[1] && $data_system.sounds[1].name!=""
pbSEPlay($data_system.sounds[1])
elsif FileTest.audio_exist?("Audio/SE/Choose")
pbSEPlay("Choose",80)
end
end
|
#pbPlayLastBattle ⇒ Object
684
685
686
|
# File 'scripts/PBattle_OrgBattle.rb', line 684
def pbPlayLastBattle
pbPlayBattle($PokemonGlobal.lastbattle)
end
|
#pbPocketNames ⇒ Object
-
Los nombres de cada uno de los bolsillos de la Mochila. Dejar el primer elemento en blanco.
-
La capacidad máxima de objetos distintos de cada bolsillo (-1 indica una
cantidad infinita). Se ignora el primer número (0).
-
La cantidad máxima de un mismo objeto que se puede llevar en la Mochila.
-
Indica por cada bolsillo si se ordena automáticamente por el número ID del objeto. Se ignora el primer número (0).
-
Indica el número del bolsillo que contiene todas las bayas. Se usa para
identificar el bolsillo que se debe mostrar cuando se está por plantar
una baya, y no se puede cambiar la vista a otro bolsillo.
150
151
152
153
154
155
156
157
158
159
|
# File 'scripts/Settings.rb', line 150
def pbPocketNames; return ["",
_INTL("Objetos"),
_INTL("Medicinas"),
_INTL("Poké Balls"),
_INTL("MTs / MOs"),
_INTL("Bayas"),
_INTL("Cartas"),
_INTL("Obj. Batallas"),
_INTL("Obj. Claves")
]; end
|
#pbPokeCenterPC ⇒ Object
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
|
# File 'scripts/PScreen_Storage.rb', line 3119
def pbPokeCenterPC
Kernel.pbMessage(_INTL("\\se[computeropen]{1} encendió el PC.",$Trainer.name))
loop do
commands=PokemonPCList.getCommandList()
command=Kernel.pbMessage(_INTL("¿A qué PC quieres acceder?"),
commands,commands.length)
if !PokemonPCList.callCommand(command)
break
end
end
pbSEPlay("computerclose")
end
|
#pbPokeCupRules(double) ⇒ Object
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 1322
def pbPokeCupRules(double)
ret=PokemonChallengeRules.new
ret.addPokemonRule(StandardRestriction.new)
ret.addLevelRule(50,55,155)
ret.addTeamRule(SpeciesClause.new)
ret.addTeamRule(ItemClause.new)
ret.addBattleRule(SleepClause.new)
ret.addBattleRule(FreezeClause.new)
ret.addBattleRule(SelfdestructClause.new)
ret.setDoubleBattle(double).setNumber(3)
return ret
end
|
#pbPokemonMart(stock, speech = nil, cantsell = false) ⇒ Object
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
|
# File 'scripts/PScreen_Mart.rb', line 792
def pbPokemonMart(stock,speech=nil,cantsell=false)
for i in 0...stock.length
stock[i]=getID(PBItems,stock[i]) if !stock[i].is_a?(Integer)
if !stock[i] || stock[i]==0 ||
(pbIsImportantItem?(stock[i]) && $PokemonBag.pbQuantity(stock[i])>0)
stock[i]=nil
end
end
stock.compact!
commands=[]
cmdBuy=-1
cmdSell=-1
cmdQuit=-1
commands[cmdBuy=commands.length]=_INTL("Me gustaría comprar algo")
commands[cmdSell=commands.length]=_INTL("Me gustaría vender algo") if !cantsell
commands[cmdQuit=commands.length]=_INTL("Solo estoy mirando")
cmd=Kernel.pbMessage(
speech ? speech : _INTL("¡Bienvenido!\r\n¿En qué puedo ayudarte?"),
commands,cmdQuit+1)
loop do
if cmdBuy>=0 && cmd==cmdBuy
scene=PokemonMartScene.new
screen=PokemonMartScreen.new(scene,stock)
screen.pbBuyScreen
elsif cmdSell>=0 && cmd==cmdSell
scene=PokemonMartScene.new
screen=PokemonMartScreen.new(scene,stock)
screen.pbSellScreen
else
Kernel.pbMessage(_INTL("¡Vuelve cuando quieras!"))
break
end
cmd=Kernel.pbMessage(
_INTL("¿En qué más puedo ayudarte?"),commands,cmdQuit+1)
end
$game_temp.clear_mart_prices
end
|
#pbPokemonString(pkmn) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'scripts/PokeBattle_OtherScenes.rb', line 1
def pbPokemonString(pkmn)
if pkmn.is_a?(PokeBattle_Battler) && !pkmn.pokemon
return ""
end
status=""
if pkmn.hp<=0
status=" [FNT]"
else
case pkmn.status
when PBStatuses::SLEEP
status=" [SLP]"
when PBStatuses::FROZEN
status=" [FRZ]"
when PBStatuses::BURN
status=" [BRN]"
when PBStatuses::PARALYSIS
status=" [PAR]"
when PBStatuses::POISON
status=" [PSN]"
end
end
return "#{pkmn.name} (Nv. #{pkmn.level})#{status} PS: #{pkmn.hp}/#{pkmn.totalhp}"
end
|
#pbPokeRadarCancel ⇒ Object
108
109
110
|
# File 'scripts/PItem_PokeRadar.rb', line 108
def pbPokeRadarCancel
$PokemonTemp.pokeradar=nil
end
|
#pbPokeRadarGetEncounter(rarity = 0) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'scripts/PItem_PokeRadar.rb', line 127
def pbPokeRadarGetEncounter(rarity=0)
if rarity>0
map=$game_map.map_id rescue 0
array=[]
for enc in POKERADAREXCLUSIVES
array.push(enc) if enc.length>=4 && enc[0]==map && getID(PBSpecies,enc[2])>0
end
if array.length>0
rnd=rand(100)
chance=0
for enc in array
chance+=enc[1]
if rnd<chance
upper=(enc[4]!=nil) ? enc[4] : enc[3]
level=enc[3]+rand(1+upper-enc[3])
return [getID(PBSpecies,enc[2]),level]
end
end
end
end
return $PokemonEncounters.pbEncounteredPokemon($PokemonEncounters.pbEncounterType,rarity+1)
end
|
#pbPokeRadarGetShakingGrass ⇒ Object
112
113
114
115
116
117
118
119
120
121
|
# File 'scripts/PItem_PokeRadar.rb', line 112
def pbPokeRadarGetShakingGrass
if $PokemonTemp.pokeradar
grasses=$PokemonTemp.pokeradar[3]
return -1 if grasses.length==0
for i in grasses
return i[2] if $game_player.x==i[0] && $game_player.y==i[1]
end
end
return -1
end
|
#pbPokeRadarHighlightGrass(showmessage = true) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'scripts/PItem_PokeRadar.rb', line 53
def pbPokeRadarHighlightGrass(showmessage=true)
grasses=[] for i in 0...4
r=rand((i+1)*8)
x=$game_player.x
y=$game_player.y
if r<=(i+1)*2
x=$game_player.x-i-1+r
y=$game_player.y-i-1
elsif r<=(i+1)*6-2
x=[$game_player.x+i+1,$game_player.x-i-1][r%2]
y=$game_player.y-i+((r-1-(i+1)*2)/2).floor
else
x=$game_player.x-i+r-(i+1)*6
y=$game_player.y+i+1
end
if x>=0 && x<$game_map.width &&
y>=0 && y<$game_map.height
if PBTerrain.isJustGrass?($game_map.terrain_tag(x,y))
s=(rand(4)==0) ? 1 : 0
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2]>0
v=[(65536/SHINYPOKEMONCHANCE)-$PokemonTemp.pokeradar[2]*200,200].max
v=0xFFFF / v
v=rand(65536) / v
s=2 if v==0
end
grasses.push([x,y,i,s])
end
end
end
if grasses.length==0
Kernel.pbMessage(_INTL("Las hojas de la hierba están quietas...")) if showmessage pbPokeRadarCancel
else
for grass in grasses
case grass[3]
when 0 $scene.spriteset.addUserAnimation(RUSTLE_NORMAL_ANIMATION_ID,grass[0],grass[1],true)
when 1 $scene.spriteset.addUserAnimation(RUSTLE_VIGOROUS_ANIMATION_ID,grass[0],grass[1],true)
when 2 $scene.spriteset.addUserAnimation(RUSTLE_SHINY_ANIMATION_ID,grass[0],grass[1],true)
end
end
$PokemonTemp.pokeradar[3]=grasses if $PokemonTemp.pokeradar
pbWait(20)
end
end
|
#pbPokeRadarOnShakingGrass ⇒ Object
#pbPopFade ⇒ Object
1218
1219
1220
1221
1222
|
# File 'scripts/SpriteWindow.rb', line 1218
def pbPopFade
if $game_temp
$game_temp.fadestate=[$game_temp.fadestate-1,0].max
end
end
|
#pbPositionFaceWindow(facewindow, msgwindow) ⇒ Object
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
|
# File 'scripts/Messages.rb', line 931
def pbPositionFaceWindow(facewindow,msgwindow)
return if !facewindow
if msgwindow
if facewindow.height<=msgwindow.height
facewindow.y=msgwindow.y
else
facewindow.y=msgwindow.y+msgwindow.height-facewindow.height
end
facewindow.x=Graphics.width-facewindow.width
msgwindow.x=0
msgwindow.width=Graphics.width-facewindow.width
else
facewindow.height=Graphics.height if facewindow.height>Graphics.height
facewindow.x=0
facewindow.y=0
end
end
|
#pbPositionNearMsgWindow(cmdwindow, msgwindow, side) ⇒ Object
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
|
# File 'scripts/Messages.rb', line 949
def pbPositionNearMsgWindow(cmdwindow,msgwindow,side)
return if !cmdwindow
if msgwindow
height=[cmdwindow.height,Graphics.height-msgwindow.height].min
if cmdwindow.height!=height
cmdwindow.height=height
end
cmdwindow.y=msgwindow.y-cmdwindow.height
if cmdwindow.y<0
cmdwindow.y=msgwindow.y+msgwindow.height
if cmdwindow.y+cmdwindow.height>Graphics.height
cmdwindow.y=msgwindow.y-cmdwindow.height
end
end
case side
when :left
cmdwindow.x=msgwindow.x
when :right
cmdwindow.x=msgwindow.x+msgwindow.width-cmdwindow.width
else
cmdwindow.x=msgwindow.x+msgwindow.width-cmdwindow.width
end
else
cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height
cmdwindow.x=0
cmdwindow.y=0
end
end
|
#pbPositionPokemonSprite(sprite, left, top) ⇒ Object
383
384
385
386
387
388
389
390
391
|
# File 'scripts/Pokemon_Sprites.rb', line 383
def pbPositionPokemonSprite(sprite,left,top)
if sprite.bitmap && !sprite.bitmap.disposed?
sprite.x=left+(128-sprite.bitmap.width)/2
sprite.y=top+(128-sprite.bitmap.height)/2
else
sprite.x=left
sprite.y=top
end
end
|
#pbPostData(url, postdata, filename = nil, depth = 0) ⇒ Object
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
# File 'scripts/Sockets.rb', line 544
def pbPostData(url, postdata, filename=nil, depth=0)
userAgent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
if url[/^http:\/\/([^\/]+)(.*)$/]
host=$1
path=$2
path="/" if path.length==0
body = postdata.map {|key, value|
keyString=key.to_s
valueString=value.to_s
keyString.gsub!(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0]) }
valueString.gsub!(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0]) }
next "#{keyString}=#{valueString}"
}.join('&')
request="POST #{path} HTTP/1.1\nUser-Agent: #{userAgent}\nPragma: no-cache\nHost: #{host}\nProxy-Connection: Close\n"
request+="Content-Type: application/x-www-form-urlencoded\n"
request+="Content-Length: #{body.length}\n"
request+="\n"
request+=body
return pbHttpRequest(host, request, filename, depth)
end
return ""
end
|
#pbPostToFile(url, postdata, file) ⇒ Object
696
697
698
699
700
701
|
# File 'scripts/Sockets.rb', line 696
def pbPostToFile(url, postdata, file)
begin
pbPostData(url, postdata,file)
rescue
end
end
|
#pbPostToString(url, postdata) ⇒ Object
687
688
689
690
691
692
693
694
|
# File 'scripts/Sockets.rb', line 687
def pbPostToString(url, postdata)
begin
data=pbPostData(url, postdata)
return data
rescue
return ""
end
end
|
#pbPrepareBattle(battle) ⇒ Object
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
|
# File 'scripts/PField_Field.rb', line 788
def pbPrepareBattle(battle)
case $game_screen.weather_type
when PBFieldWeather::Rain, PBFieldWeather::HeavyRain, PBFieldWeather::Storm
battle.weather=PBWeather::RAINDANCE
battle.weatherduration=-1
when PBFieldWeather::Snow, PBFieldWeather::Blizzard
battle.weather=PBWeather::HAIL
battle.weatherduration=-1
when PBFieldWeather::Sandstorm
battle.weather=PBWeather::SANDSTORM
battle.weatherduration=-1
when PBFieldWeather::Sun
battle.weather=PBWeather::SUNNYDAY
battle.weatherduration=-1
end
battle.shiftStyle=($PokemonSystem.battlestyle==0)
battle.battlescene=($PokemonSystem.battlescene==0)
battle.environment=pbGetEnvironment
end
|
#pbPrimeCupRules(double) ⇒ Object
#pbPrintException(e) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'scripts/Compiler.rb', line 38
def pbPrintException(e)
emessage=pbGetExceptionMessage(e)
btrace=""
if e.backtrace
maxlength=$INTERNAL ? 25 : 10
e.backtrace[0,maxlength].each do |i|
btrace=btrace+"#{i}\r\n"
end
end
btrace.gsub!(/Section(\d+)/){$RGSS_SCRIPTS[$1.to_i][1]}
message="Excepción: #{e.class}\r\nMensaje: #{emessage}\r\n#{btrace}"
errorlog="errorlog.txt"
if (Object.const_defined?(:RTP) rescue false)
errorlog=RTP.getSaveFileName("errorlog.txt")
end
errorlogline=errorlog.sub(Dir.pwd+"\\","")
errorlogline=errorlogline.sub(Dir.pwd+"/","")
if errorlogline.length>20
errorlogline="\r\n"+errorlogline
end
File.open(errorlog,"ab"){|f| f.write(message) }
if !e.is_a?(Hangup)
print("#{message}\r\nEsta excepción ha sido registrada en #{errorlogline}.\r\nPresiona Ctrl+C para copiar este mensaje al portapapeles.")
end
end
|
#pbPropertyList(title, data, properties, saveprompt = false) ⇒ Object
Core property editor script
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
|
# File 'scripts/Editor.rb', line 2071
def pbPropertyList(title,data,properties,saveprompt=false)
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
list=pbListWindow([],Graphics.width*5/10)
list.viewport=viewport
list.z=2
title=Window_UnformattedTextPokemon.new(title)
title.x=list.width
title.y=0
title.width=Graphics.width*5/10
title.height=64
title.viewport=viewport
title.z=2
desc=Window_UnformattedTextPokemon.new("")
desc.x=list.width
desc.y=title.height
desc.width=Graphics.width*5/10
desc.height=Graphics.height-title.height
desc.viewport=viewport
desc.z=2
selectedmap=-1
index=0
retval=nil
commands=[]
for i in 0...properties.length
propobj=properties[i][1]
commands.push(sprintf("%s=%s",properties[i][0],propobj.format(data[i])))
end
list.commands=commands
list.index=0
begin
loop do
Graphics.update
Input.update
list.update
desc.update
if list.index!=selectedmap
desc.text=properties[list.index][2]
selectedmap=list.index
end
if Input.trigger?(Input::A)
propobj=properties[selectedmap][1]
if propobj!=ReadOnlyProperty && !propobj.is_a?(ReadOnlyProperty) &&
Kernel.pbConfirmMessage(_INTL("¿Restablecer valor {1}?",properties[selectedmap][0]))
if propobj.respond_to?("defaultValue")
data[selectedmap]=propobj.defaultValue
else
data[selectedmap]=nil
end
end
commands.clear
for i in 0...properties.length
propobj=properties[i][1]
commands.push(sprintf("%s=%s",properties[i][0],propobj.format(data[i])))
end
list.commands=commands
elsif Input.trigger?(Input::C) || (list.doubleclick? rescue false)
propobj=properties[selectedmap][1]
oldsetting=data[selectedmap]
newsetting=propobj.set(properties[selectedmap][0],oldsetting)
data[selectedmap]=newsetting
commands.clear
for i in 0...properties.length
propobj=properties[i][1]
commands.push(sprintf("%s=%s",properties[i][0],propobj.format(data[i])))
end
list.commands=commands
break
elsif Input.trigger?(Input::B)
selectedmap=-1
break
end
end
if selectedmap==-1 && saveprompt
cmd=Kernel.pbMessage(_INTL("¿Guardar cambios?"),
[_INTL("Sí"),_INTL("No"),_INTL("Salir")],3)
if cmd==2
selectedmap=list.index
else
retval=(cmd==0)
end
end
end while selectedmap!=-1
title.dispose
list.dispose
desc.dispose
Input.update
return retval
end
|
#pbPurify(pokemon, scene) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 7
def pbPurify(pokemon,scene)
if pokemon.heartgauge==0 && pokemon.shadow
return if !pokemon.savedev && !pokemon.savedexp
pokemon.shadow=false
pokemon.giveRibbon(PBRibbons::NATIONAL)
scene.pbDisplay(_INTL("{1} ha abierto la puerta de su corazón!",pokemon.name))
oldmoves=[]
for i in 0...4; oldmoves.push(pokemon.moves[i].id); end
pokemon.pbUpdateShadowMoves()
for i in 0...4
if pokemon.moves[i].id!=0 && pokemon.moves[i].id!=oldmoves[i]
scene.pbDisplay(_INTL("¡{1} ha recuperado el movimiento \n{2}!",
pokemon.name,PBMoves.getName(pokemon.moves[i].id)))
end
end
pokemon.pbRecordFirstMoves
if pokemon.savedev
for i in 0...6
pbApplyEVGain(pokemon,i,pokemon.savedev[i])
end
pokemon.savedev=nil
end
newexp=PBExperience.pbAddExperience(pokemon.exp,pokemon.savedexp||0,pokemon.growthrate)
pokemon.savedexp=nil
newlevel=PBExperience.pbGetLevelFromExperience(newexp,pokemon.growthrate)
curlevel=pokemon.level
if newexp!=pokemon.exp
scene.pbDisplay(_INTL("¡{1} ha recuperado {2} Puntos de Experiencia!",pokemon.name,newexp-pokemon.exp))
end
if newlevel==curlevel
pokemon.exp=newexp
pokemon.calcStats
else
pbChangeLevel(pokemon,newlevel,scene) pokemon.exp=newexp
end
speciesname=PBSpecies.getName(pokemon.species)
if scene.pbConfirm(_INTL("¿Quieres darle un apodo a {1}?",speciesname))
helptext=_INTL("Apodo de {1}",speciesname)
newname=pbEnterPokemonName(helptext,0,10,"",pokemon)
pokemon.name=newname if newname!=""
end
end
end
|
#pbPurifyChamber ⇒ Object
1106
1107
1108
1109
1110
1111
1112
1113
|
# File 'scripts/PScreen_PurifyChamber.rb', line 1106
def pbPurifyChamber()
$PokemonGlobal.seenPurifyChamber=true
pbFadeOutIn(99999){
scene=PurifyChamberScene.new()
screen=PurifyChamberScreen.new(scene)
screen.pbStartPurify()
}
end
|
#pbPushBranch(list, script, indent = 0) ⇒ Object
2827
2828
2829
|
# File 'scripts/Compiler.rb', line 2827
def pbPushBranch(list,script,indent=0)
list.push(RPG::EventCommand.new(111,indent,[12,script]))
end
|
#pbPushBranchEnd(list, indent = 0) ⇒ Object
2822
2823
2824
2825
|
# File 'scripts/Compiler.rb', line 2822
def pbPushBranchEnd(list,indent=0)
list.push(RPG::EventCommand.new(0,indent,[]))
list.push(RPG::EventCommand.new(412,indent-1,[]))
end
|
2773
2774
2775
2776
2777
2778
|
# File 'scripts/Compiler.rb', line 2773
def (list,cmt,indent=0)
textsplit2=cmt.split(/\n/)
for i in 0...textsplit2.length
list.push(RPG::EventCommand.new(i==0 ? 108 : 408,indent,[textsplit2[i].gsub(/\s+$/,"")]))
end
end
|
#pbPushElse(list, indent = 0) ⇒ Object
2817
2818
2819
2820
|
# File 'scripts/Compiler.rb', line 2817
def pbPushElse(list,indent=0)
list.push(RPG::EventCommand.new(0,indent,[]))
list.push(RPG::EventCommand.new(411,indent-1,[]))
end
|
#pbPushEnd(list) ⇒ Object
2769
2770
2771
|
# File 'scripts/Compiler.rb', line 2769
def pbPushEnd(list)
list.push(RPG::EventCommand.new(0,0,[]))
end
|
#pbPushEvent(list, cmd, params = nil, indent = 0) ⇒ Object
2765
2766
2767
|
# File 'scripts/Compiler.rb', line 2765
def pbPushEvent(list,cmd,params=nil,indent=0)
list.push(RPG::EventCommand.new(cmd,indent,params ? params : []))
end
|
#pbPushExit(list, indent = 0) ⇒ Object
2813
2814
2815
|
# File 'scripts/Compiler.rb', line 2813
def pbPushExit(list,indent=0)
list.push(RPG::EventCommand.new(115,indent,[]))
end
|
#pbPushFade ⇒ Object
1212
1213
1214
1215
1216
|
# File 'scripts/SpriteWindow.rb', line 1212
def pbPushFade
if $game_temp
$game_temp.fadestate=[$game_temp.fadestate+1,0].max
end
end
|
#pbPushMoveRoute(list, character, route, indent = 0) ⇒ Object
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
|
# File 'scripts/Compiler.rb', line 2745
def pbPushMoveRoute(list,character,route,indent=0)
if route.is_a?(Array)
route=pbGenerateMoveRoute(route)
end
for i in 0...route.list.length
list.push(RPG::EventCommand.new(
i==0 ? 209 : 509,indent,
i==0 ? [character,route] : [route.list[i-1]]))
end
end
|
#pbPushMoveRouteAndWait(list, character, route, indent = 0) ⇒ Object
2756
2757
2758
2759
|
# File 'scripts/Compiler.rb', line 2756
def pbPushMoveRouteAndWait(list,character,route,indent=0)
pbPushMoveRoute(list,character,route,indent)
pbPushEvent(list,210,[],indent)
end
|
#pbPushScript(list, script, indent = 0) ⇒ Object
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
|
# File 'scripts/Compiler.rb', line 2800
def pbPushScript(list,script,indent=0)
return if !script
first=true
textsplit2=script.split(/\n/)
for i in 0...textsplit2.length
textchunk=textsplit2[i].gsub(/\s+$/,"")
if textchunk && textchunk!=""
list.push(RPG::EventCommand.new(first ? 355 : 655,indent,[textchunk]))
first=false
end
end
end
|
#pbPushSelfSwitch(list, swtch, switchOn, indent = 0) ⇒ Object
2831
2832
2833
|
# File 'scripts/Compiler.rb', line 2831
def pbPushSelfSwitch(list,swtch,switchOn,indent=0)
list.push(RPG::EventCommand.new(123,indent,[swtch,switchOn ? 0 : 1]))
end
|
#pbPushText(list, text, indent = 0) ⇒ Object
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
|
# File 'scripts/Compiler.rb', line 2780
def pbPushText(list,text,indent=0)
return if !text
textsplit=text.split(/\\m/)
for t in textsplit
first=true
if $RPGVX
list.push(RPG::EventCommand.new(101,indent,["",0,0,2]))
first=false
end
textsplit2=t.split(/\n/)
for i in 0...textsplit2.length
textchunk=textsplit2[i].gsub(/\s+$/,"")
if textchunk && textchunk!=""
list.push(RPG::EventCommand.new(first ? 101 : 401,indent,[textchunk]))
first=false
end
end
end
end
|
#pbPushWait(list, frames, indent = 0) ⇒ Object
2761
2762
2763
|
# File 'scripts/Compiler.rb', line 2761
def pbPushWait(list,frames,indent=0)
pbPushEvent(list,106,[frames],indent)
end
|
#pbRaiseEffortValues(pokemon, ev, evgain = 10, evlimit = true) ⇒ Object
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
# File 'scripts/PItem_Items.rb', line 383
def pbRaiseEffortValues(pokemon,ev,evgain=10,evlimit=true)
if pokemon.ev[ev]>=100 && evlimit
return 0
end
totalev=0
for i in 0...6
totalev+=pokemon.ev[i]
end
if totalev+evgain>PokeBattle_Pokemon::EVLIMIT
evgain=PokeBattle_Pokemon::EVLIMIT-totalev
end
if pokemon.ev[ev]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
evgain=PokeBattle_Pokemon::EVSTATLIMIT-pokemon.ev[ev]
end
if evlimit && pokemon.ev[ev]+evgain>100
evgain=100-pokemon.ev[ev]
end
if evgain>0
pokemon.ev[ev]+=evgain
pokemon.calcStats
end
return evgain
end
|
#pbRaiseHappinessAndLowerEV(pokemon, scene, ev, messages) ⇒ Object
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
|
# File 'scripts/PItem_Items.rb', line 407
def pbRaiseHappinessAndLowerEV(pokemon,scene,ev,messages)
h=(pokemon.happiness<255)
e=(pokemon.ev[ev]>0)
if !h && !e
scene.pbDisplay(_INTL("No tuvo ningún efecto."))
return false
end
if h
pokemon.changeHappiness("EV berry")
end
if e
pokemon.ev[ev]-=10
pokemon.ev[ev]=0 if pokemon.ev[ev]<0
pokemon.calcStats
end
scene.pbRefresh
scene.pbDisplay(messages[2-(h ? 0 : 1)-(e ? 0 : 2)])
return true
end
|
#pbRaiseHappinessAndReduceHeart(pokemon, scene, amount) ⇒ Object
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 200
def pbRaiseHappinessAndReduceHeart(pokemon,scene,amount)
if !pokemon.isShadow?
scene.pbDisplay(_INTL("No tendrá ningún efecto."))
return false
end
if pokemon.happiness==255 && pokemon.heartgauge==0
scene.pbDisplay(_INTL("No tendrá ningún efecto."))
return false
elsif pokemon.happiness==255
pokemon.adjustHeart(-amount)
scene.pbDisplay(_INTL("¡{1} te adora!\nLa puerta de su corazón se ha abierto un poco.",pokemon.name))
pbReadyToPurify(pokemon)
return true
elsif pokemon.heartgauge==0
pokemon.changeHappiness("vitamin")
scene.pbDisplay(_INTL("{1} se ha vuelto amistoso.",pokemon.name))
return true
else
pokemon.changeHappiness("vitamin")
pokemon.adjustHeart(-amount)
scene.pbDisplay(_INTL("{1} se ha vuelto amistoso.\nLa puerta de su corazón se ha abierto un poco.",pokemon.name))
pbReadyToPurify(pokemon)
return true
end
end
|
#pbRandomEncounterSpecies(enctype) ⇒ Object
253
254
255
256
257
|
# File 'scripts/PScreen_Phone.rb', line 253
def pbRandomEncounterSpecies(enctype)
return 0 if !enctype
len=[enctype.length,4].min
return enctype[rand(len)][0]
end
|
#pbRandomMove ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1
def pbRandomMove
loop do
if false
move=rand(0xA6)+1
else
move=rand(PBMoves.maxValue)+1
next if move>384 || isConst?(move,PBMoves,:SKETCH) || isConst?(move,PBMoves,:STRUGGLE)
end
return move if PBMoves.getName(move)!=""
end
end
|
#pbRandomPhoneItem(array) ⇒ Object
#pbRandomPhoneTrainer ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'scripts/PScreen_Phone.rb', line 1
def pbRandomPhoneTrainer
if !$PokemonGlobal.phoneNumbers
$PokemonGlobal.phoneNumbers=[]
end
temparray=[]
for num in $PokemonGlobal.phoneNumbers
if num[0] && num.length==8 if $game_player && $game_map.map_id==num[6] next
end
callerregion=pbGetMetadata(num[6],MetadataMapPosition)
currentregion=pbGetMetadata($game_map.map_id,MetadataMapPosition)
if callerregion && currentregion && callerregion[0]!=currentregion[0]
next end
temparray.push(num)
end
end
return nil if temparray.length==0
return temparray[rand(temparray.length)]
end
|
#pbRandomPokemonFromRule(rule, trainer) ⇒ Object
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 318
def pbRandomPokemonFromRule(rule,trainer)
pkmn=nil
i=0
iteration=-1
begin
iteration+=1
species=0
level=rule.ruleset.suggestedLevel
loop do
species=0
loop do
species=rand(PBSpecies.maxValue)+1
cname=getConstantName(PBSpecies,species) rescue nil
break if cname
end
r=rand(20)
bst=baseStatTotal(species)
next if level<minimumLevel(species)
if iteration%2==0
if r<16 && bst<400
next
end
if r<13 && bst<500
next
end
else
if bst>400
next
end
if r<10 && babySpecies(species)!=species
next
end
end
if r<10 && babySpecies(species)==species
next
end
if r<7 && evolutions(species).length>0
next
end
break
end
ev=rand(0x3F)+1
nature=0
loop do
nature=rand(25)
nd5=(nature/5).floor nm5=(nature%5).floor if nd5==nm5 || nature==PBNatures::LAX || nature==PBNatures::GENTLE
next if rand(20)<19
else
if ((ev>>(1+nd5))&1)==0
next if rand(10)<6
end
if ((ev>>(1+nm5))&1)!=0
next if rand(10)<9
end
end
break
end
item=0
if level!=$legalMovesLevel
$legalMoves=[]
end
if !$legalMoves[species]
$legalMoves[species]=pbGetLegalMoves2(species,level)
end
itemlist=[
:ORANBERRY,:SITRUSBERRY,:ADAMANTORB,:BABIRIBERRY,
:BLACKSLUDGE,:BRIGHTPOWDER,:CHESTOBERRY,:CHOICEBAND,
:CHOICESCARF,:CHOICESPECS,:CHOPLEBERRY,:DAMPROCK,
:DEEPSEATOOTH,:EXPERTBELT,:FLAMEORB,:FOCUSSASH,
:FOCUSBAND,:HEATROCK,:LEFTOVERS,:LIFEORB,:LIGHTBALL,
:LIGHTCLAY,:LUMBERRY,:OCCABERRY,:PETAYABERRY,:SALACBERRY,
:SCOPELENS,:SHEDSHELL,:SHELLBELL,:SHUCABERRY,:LIECHIBERRY,
:SILKSCARF,:THICKCLUB,:TOXICORB,:WIDELENS,:YACHEBERRY,
:HABANBERRY,:SOULDEW,:PASSHOBERRY,:QUICKCLAW,:WHITEHERB
]
loop do
if rand(40)==0
item=getID(PBItems,:LEFTOVERS)
break
end
itemsym=itemlist[rand(itemlist.length)]
item=getID(PBItems,itemsym)
next if item==0
if itemsym==:LIGHTBALL
next if !isConst?(species,PBSpecies,:PIKACHU)
end
if itemsym==:SHEDSHELL
next if !isConst?(species,PBSpecies,:FORRETRESS) ||
!isConst?(species,PBSpecies,:SKARMORY)
end
if itemsym==:SOULDEW
next if !isConst?(species,PBSpecies,:LATIOS) ||
!isConst?(species,PBSpecies,:LATIAS)
end
if itemsym==:LIECHIBERRY && (ev&0x02)==0
if rand(2)==0
next
else
ev|=0x02
end
end
if itemsym==:FOCUSSASH
next if baseStatTotal(species)>450 && rand(10)<8
end
if itemsym==:ADAMANTORB
next if !isConst?(species,PBSpecies,:DIALGA)
end
if itemsym==:PASSHOBERRY
next if !isConst?(species,PBSpecies,:STEELIX)
end
if itemsym==:BABIRIBERRY
next if !isConst?(species,PBSpecies,:TYRANITAR)
end
if itemsym==:HABANBERRY
next if !isConst?(species,PBSpecies,:GARCHOMP)
end
if itemsym==:OCCABERRY
next if !isConst?(species,PBSpecies,:METAGROSS)
end
if itemsym==:CHOPLEBERRY
next if !isConst?(species,PBSpecies,:UMBREON)
end
if itemsym==:YACHEBERRY
next if !isConst?(species,PBSpecies,:TORTERRA) &&
!isConst?(species,PBSpecies,:GLISCOR) &&
!isConst?(species,PBSpecies,:DRAGONAIR)
end
if itemsym==:SHUCABERRY
next if !isConst?(species,PBSpecies,:HEATRAN)
end
if itemsym==:SALACBERRY && (ev&0x08)==0
if rand(2)==0
next
else
ev|=0x08
end
end
if itemsym==:PETAYABERRY && (ev&0x10)==0
if rand(2)==0
next
else
ev|=0x10
end
end
if itemsym==(:DEEPSEATOOTH)
next if !isConst?(species,PBSpecies,:CLAMPERL)
end
if itemsym==(:THICKCLUB)
next if !isConst?(species,PBSpecies,:CUBONE) &&
!isConst?(species,PBSpecies,:MAROWAK)
end
break
end
if level<10
item=(getConst(PBItems,:ORANBERRY) || item) if rand(40)==0 ||
isConst?(item,PBItems,:SITRUSBERRY)
end
if level>20
item=(getConst(PBItems,:SITRUSBERRY) || item) if rand(40)==0 ||
isConst?(item,PBItems,:ORANBERRY)
end
moves=$legalMoves[species]
sketch=false
if isConst?(moves[0],PBMoves,:SKETCH)
sketch=true
moves[0]=pbRandomMove
moves[1]=pbRandomMove
moves[2]=pbRandomMove
moves[3]=pbRandomMove
end
next if moves.length==0
if (moves|[]).length<4
moves=[getID(PBMoves,:TACKLE)] if moves.length==0
moves|=[]
else
newmoves=[]
rest=(getConst(PBMoves,:REST) || -1)
spitup=(getConst(PBMoves,:SPITUP) || -1)
swallow=(getConst(PBMoves,:SWALLOW) || -1)
stockpile=(getConst(PBMoves,:STOCKPILE) || -1)
snore=(getConst(PBMoves,:SNORE) || -1)
sleeptalk=(getConst(PBMoves,:SLEEPTALK) || -1)
loop do
newmoves.clear
while newmoves.length<4
m=moves[rand(moves.length)]
if rand(2)==0 && hasMorePowerfulMove(moves,m)
next
end
if !newmoves.include?(m) && m!=0
newmoves.push(m)
end
end
if (newmoves.include?(spitup) ||
newmoves.include?(swallow)) && !newmoves.include?(stockpile)
next unless sketch
end
if (!newmoves.include?(spitup) && !newmoves.include?(swallow)) &&
newmoves.include?(stockpile)
next unless sketch
end
if newmoves.include?(sleeptalk) && !newmoves.include?(rest)
next unless (sketch || !moves.include?(rest)) && rand(10)<2
end
if newmoves.include?(snore) && !newmoves.include?(rest)
next unless (sketch || !moves.include?(rest)) && rand(10)<2
end
totalbasedamage=0
hasPhysical=false
hasSpecial=false
hasNormal=false
for move in newmoves
d=moveData(move)
totalbasedamage+=d.basedamage
if d.basedamage>=1
hasNormal=true if isConst?(d.type,PBTypes,:NORMAL)
hasPhysical=true if d.category==0
hasSpecial=true if d.category==1
end
end
if !hasPhysical && (ev&0x02)!=0
next if rand(10)<8
end
if !hasSpecial && (ev&0x10)!=0
next if rand(10)<8
end
r=rand(10)
next if r>6 && totalbasedamage>180
next if r>8 && totalbasedamage>140
next if totalbasedamage==0 && rand(20)!=0
if hasPhysical && !hasSpecial
ev&=~0x10 if rand(10)<8 ev|=0x02 if rand(10)<8 end
if !hasPhysical && hasSpecial
ev|=0x10 if rand(10)<8 ev&=~0x02 if rand(10)<8 end
if !hasNormal && isConst?(item,PBItems,:SILKSCARF)
item=getID(PBItems,:LEFTOVERS)
end
moves=newmoves
break
end
end
for i in 0...4
moves[i]=0 if !moves[i]
end
if isConst?(item,PBItems,:LIGHTCLAY) &&
!moves.include?((getConst(PBMoves,:LIGHTSCREEN) || -1)) &&
!moves.include?((getConst(PBMoves,:REFLECT) || -1))
item=getID(PBItems,:LEFTOVERS)
end
if isConst?(item,PBItems,:BLACKSLUDGE)
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,species,8)
type1=dexdata.fgetb
type2=dexdata.fgetb
dexdata.close
if !isConst?(type1,PBTypes,:POISON) && !isConst?(type2,PBTypes,:POISON)
item=getID(PBItems,:LEFTOVERS)
end
end
if isConst?(item,PBItems,:HEATROCK) &&
!moves.include?((getConst(PBMoves,:SUNNYDAY) || -1))
item=getID(PBItems,:LEFTOVERS)
end
if isConst?(item,PBItems,:DAMPROCK) &&
!moves.include?((getConst(PBMoves,:RAINDANCE) || -1))
item=getID(PBItems,:LEFTOVERS)
end
if moves.include?((getConst(PBMoves,:REST) || -1))
item=getID(PBItems,:LUMBERRY) if rand(3)==0
item=getID(PBItems,:CHESTOBERRY) if rand(4)==0
end
pk=PBPokemon.new(species,item,nature,moves[0],moves[1],moves[2],moves[3],ev)
pkmn=pk.createPokemon(level,31,trainer)
i+=1
end while !rule.ruleset.isPokemonValid?(pkmn)
return pkmn
end
|
#pbRandomRoam(index) ⇒ Object
Puts a roamer in a completely random map available to it.
38
39
40
41
42
43
|
# File 'scripts/PField_RoamingPokemon.rb', line 38
def pbRandomRoam(index)
if $PokemonGlobal.roamPosition
keys=pbRoamingAreas(index).keys
$PokemonGlobal.roamPosition[index]=keys[rand(keys.length)]
end
end
|
#pbRandomRoomTile(dungeon, tiles) ⇒ Object
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
|
# File 'scripts/PField_RandomDungeons.rb', line 543
def pbRandomRoomTile(dungeon,tiles)
ar1=AntiRandom.new(dungeon.width)
ar2=AntiRandom.new(dungeon.height)
for i in 0...(tiles.length+1)*1000
x=ar1.get()
y=ar2.get()
if dungeon.isRoom?(x,y) && (!tiles.any?{|item|
(item[0]-x).abs<2 && (item[1]-y).abs<2 })
ret=[x,y]
tiles.push(ret)
return ret
end
end
return nil
end
|
#pbReadyToPurify(pokemon) ⇒ Object
458
459
460
461
462
463
464
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 458
def pbReadyToPurify(pokemon)
return if !pokemon || !pokemon.isShadow?
pokemon.pbUpdateShadowMoves()
if pokemon.heartgauge==0
Kernel.pbMessage(_INTL("{1} está listo para la purificación!",pokemon.name))
end
end
|
#pbReceiveMysteryGift(id) ⇒ Object
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
# File 'scripts/PScreen_MysteryGift.rb', line 379
def pbReceiveMysteryGift(id)
index=-1
for i in 0...$Trainer.mysterygift.length
if $Trainer.mysterygift[i][0]==id && $Trainer.mysterygift[i].length>1
index=i
break
end
end
if index==-1
Kernel.pbMessage(_INTL("No se pudo encontrar un Regalo Misterioso sin reclamar con ID {1}.",id))
return false
end
gift=$Trainer.mysterygift[index]
if gift[1]==0
pID=rand(256)
pID|=rand(256)<<8
pID|=rand(256)<<16
pID|=rand(256)<<24
gift[2].personalID=pID
gift[2].calcStats
time=pbGetTimeNow
gift[2].timeReceived=time.getgm.to_i
gift[2].obtainMode=4 gift[2].pbRecordFirstMoves
if $game_map
gift[2].obtainMap=$game_map.map_id
gift[2].obtainLevel=gift[2].level
else
gift[2].obtainMap=0
gift[2].obtainLevel=gift[2].level
end
if pbAddPokemonSilent(gift[2])
Kernel.pbMessage(_INTL("¡{1} ha recibido {2}!\\se[ItemGet]\1",$Trainer.name,gift[2].name))
$Trainer.mysterygift[index]=[id]
return true
end
elsif gift[1]>0
if $PokemonBag.pbCanStore?(gift[2],gift[1])
$PokemonBag.pbStoreItem(gift[2],gift[1])
item=gift[2]; qty=gift[1]
itemname=(qty>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4
Kernel.pbMessage(_INTL("\\se[ItemGet]¡{1} ha recibido \\c[1]{2}\\c[0]!\\nÉste contiene \\c[1]{3}\\c[0].\\wtnp[30]",
$Trainer.name,itemname,PBMoves.getName($ItemData[item][ITEMMACHINE])))
elsif isConst?(item,PBItems,:LEFTOVERS)
Kernel.pbMessage(_INTL("\\se[ItemGet]¡{1} ha recibido unos \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
elsif qty>1
Kernel.pbMessage(_INTL("\\se[ItemGet]¡{1} ha recibido {2} \\c[1]{3}\\c[0]!\\wtnp[30]",$Trainer.name,qty,itemname))
else
Kernel.pbMessage(_INTL("\\se[ItemGet]¡{1} ha recibido un \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
end
$Trainer.mysterygift[index]=[id]
return true
end
end
return false
end
|
#pbRecord(text, maxtime = 30.0) ⇒ Object
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
|
# File 'scripts/PField_Field.rb', line 2019
def pbRecord(text,maxtime=30.0)
text="" if !text
textwindow=Window_UnformattedTextPokemon.newWithSize(text,
0,0,Graphics.width,Graphics.height-96)
textwindow.z=99999
if text==""
textwindow.visible=false
end
wave=nil
msgwindow=Kernel.pbCreateMessageWindow
oldvolume=Kernel.Audio_bgm_get_volume()
Kernel.Audio_bgm_set_volume(0)
delay=2
delay.times do |i|
Kernel.pbMessageDisplay(msgwindow,
_ISPRINTF("Recording in {1:d} second(s)...\nPress ESC to cancel.",delay-i),false)
Graphics.frame_rate.times do
Graphics.update
Input.update
textwindow.update
msgwindow.update
if Input.trigger?(Input::B)
Kernel.Audio_bgm_set_volume(oldvolume)
Kernel.pbDisposeMessageWindow(msgwindow)
textwindow.dispose
return nil
end
end
end
Kernel.pbMessageDisplay(msgwindow,
_INTL("GRABANDO\nPresione ESC para cancelar."),false)
if beginRecordUI
frames=(maxtime*Graphics.frame_rate).to_i
frames.times do
Graphics.update
Input.update
textwindow.update
msgwindow.update
if Input.trigger?(Input::B)
break
end
end
tmpFile=ENV["TEMP"]+"\\record.wav"
endRecord(tmpFile)
wave=getWaveDataUI(tmpFile,true)
if wave
Kernel.pbMessageDisplay(msgwindow,_INTL("REPRODUCIENDO..."),false)
textwindow.update
msgwindow.update
Graphics.update
Input.update
wave.play
(Graphics.frame_rate*wave.time).to_i.times do
Graphics.update
Input.update
textwindow.update
msgwindow.update
end
end
end
Kernel.Audio_bgm_set_volume(oldvolume)
Kernel.pbDisposeMessageWindow(msgwindow)
textwindow.dispose
return wave
end
|
#pbRecordLastBattle ⇒ Object
646
647
648
649
|
# File 'scripts/PBattle_OrgBattle.rb', line 646
def pbRecordLastBattle
$PokemonGlobal.lastbattle=$PokemonTemp.lastbattle
$PokemonTemp.lastbattle=nil
end
|
#pbRefreshMGCommands(master, online) ⇒ Object
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'scripts/PScreen_MysteryGift.rb', line 239
def pbRefreshMGCommands(master,online)
commands=[]
for gift in master
itemname="BLANK"
if gift[1]==0
itemname=PBSpecies.getName(gift[2].species)
elsif gift[1]>0
itemname=PBItems.getName(gift[2])+sprintf(" x%d",gift[1])
end
ontext=["[ ]","[X]"][(online.include?(gift[0])) ? 1 : 0]
commands.push(_ISPRINTF("{1:s} {2:d}: {3:s} ({4:s})",ontext,gift[0],gift[3],itemname))
end
commands.push(_INTL("Exportar selec. a archivo"))
commands.push(_INTL("Salir"))
return commands
end
|
#pbRefreshSceneMap ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
|
# File 'scripts/Messages.rb', line 130
def pbRefreshSceneMap
if $scene && $scene.is_a?(Scene_Map)
if $scene.respond_to?("miniupdate")
$scene.miniupdate
else
$scene.updatemini
end
elsif $scene && $scene.is_a?(Scene_Battle)
$scene.updatemini
end
end
|
#pbRegisterPartner(trainerid, trainername, partyid = 0) ⇒ Object
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
|
# File 'scripts/PField_Field.rb', line 1875
def pbRegisterPartner(trainerid,trainername,partyid=0)
Kernel.pbCancelVehicles
trainer=pbLoadTrainer(trainerid,trainername,partyid)
Events.onTrainerPartyLoad.trigger(nil,trainer)
trainerobject=PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)
trainerobject.setForeignID($Trainer)
for i in trainer[2]
i.trainerID=trainerobject.id
i.ot=trainerobject.name
i.calcStats
end
$PokemonGlobal.partner=[trainerid,trainerobject.name,trainerobject.id,trainer[2]]
end
|
#pbRelearnMoveScreen(pokemon) ⇒ Object
217
218
219
220
221
222
223
224
225
|
# File 'scripts/PScreen_MoveRelearner.rb', line 217
def pbRelearnMoveScreen(pokemon)
retval=true
pbFadeOutIn(99999){
scene=MoveRelearnerScene.new
screen=MoveRelearnerScreen.new(scene)
retval=screen.pbStartScreen(pokemon)
}
return retval
end
|
#pbRelicStone ⇒ Object
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 185
def pbRelicStone
if pbHasPurifiableInParty()
Kernel.pbMessage(_INTL("¡Hay un Pokemon que podría habrír la puerta de su corazón!"))
pbChoosePokemon(1,2,proc {|poke|
!poke.isEgg? && poke.hp>0 && poke.isShadow? && poke.heartgauge==0
})
if $game_variables[1]>=0
pbRelicStoneScreen($Trainer.party[$game_variables[1]])
end
else
Kernel.pbMessage(_INTL("No tienen ningún Pokemon que pueda ser purificado."))
end
end
|
#pbRelicStoneScreen(pkmn) ⇒ Object
162
163
164
165
166
167
168
169
170
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 162
def pbRelicStoneScreen(pkmn)
retval=true
pbFadeOutIn(99999){
scene=RelicStoneScene.new
screen=RelicStoneScreen.new(scene)
retval=screen.pbStartScreen(pkmn)
}
return retval
end
|
#pbRemoveDependencies ⇒ Object
12
13
14
15
|
# File 'scripts/PField_DependentEvents.rb', line 12
def pbRemoveDependencies()
$PokemonTemp.dependentEvents.removeAllEvents()
pbDeregisterPartner() rescue nil
end
|
#pbRemoveDependency(event) ⇒ Object
21
22
23
|
# File 'scripts/PField_DependentEvents.rb', line 21
def pbRemoveDependency(event)
$PokemonTemp.dependentEvents.removeEvent(event)
end
|
#pbRemoveDependency2(eventName) ⇒ Object
34
35
36
|
# File 'scripts/PField_DependentEvents.rb', line 34
def pbRemoveDependency2(eventName)
$PokemonTemp.dependentEvents.removeEventByName(eventName)
end
|
#pbRemoveDuplicates(party) ⇒ Object
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1277
def pbRemoveDuplicates(party)
ret=[]
for pk in party
found=false
count=0
firstIndex=-1
for i in 0...ret.length
pk2=ret[i]
if isBattlePokemonDuplicate(pk,pk2)
found=true; break
end
if pk.species==pk2.species
firstIndex=i if count==0
count+=1
end
end
if !found
if count>=10
ret.delete_at(firstIndex)
end
ret.push(pk)
end
end
return ret
end
|
#pbRepel(item, steps) ⇒ Object
UseFromBag handlers Valores de retorno: 0 = no usado
1 = usado, objeto no consumido
2 = cierra la mochila para usarlo, objeto no consumido
3 = usado, objeto consumido
4 = cierra la mochila para usarlo, objeto consumido
14
15
16
17
18
19
20
21
22
23
|
# File 'scripts/PItem_ItemEffects.rb', line 14
def pbRepel(item,steps)
if $PokemonGlobal.repel>0
Kernel.pbMessage(_INTL("Pero todavía tiene efecto el último Repente utilizado."))
return 0
else
Kernel.pbMessage(_INTL("{1} ha usado {2}.",$Trainer.name,PBItems.getName(item)))
$PokemonGlobal.repel=steps
return 3
end
end
|
#pbReplaceMoves(pokemon, move1, move2 = 0, move3 = 0, move4 = 0) ⇒ Object
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
# File 'scripts/Pokemon_ShadowPokemon.rb', line 321
def pbReplaceMoves(pokemon,move1,move2=0,move3=0,move4=0)
return if !pokemon
[move1,move2,move3,move4].each{|move|
moveIndex=-1
if move!=0
for i in 0...4
moveIndex=i if pokemon.moves[i].id==move
end
end
if moveIndex==-1
for i in 0...4
if (pokemon.moves[i].id==0 && move!=0) || (
pokemon.moves[i].id!=move1 &&
pokemon.moves[i].id!=move2 &&
pokemon.moves[i].id!=move3 &&
pokemon.moves[i].id!=move4)
pokemon.moves[i]=PBMove.new(move)
break
end
end
end
}
end
|
#pbReplenishBattlePokemon(party, rule) ⇒ Object
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1304
def pbReplenishBattlePokemon(party,rule)
while party.length<20
pkmn=pbRandomPokemonFromRule(rule,nil)
found=false
for pk in party
if isBattlePokemonDuplicate(pkmn,pk)
found=true; break
end
end
party.push(pkmn) if !found
end
end
|
#pbRepositionMessageWindow(msgwindow, linecount = 2) ⇒ Object
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
|
# File 'scripts/Messages.rb', line 1146
def pbRepositionMessageWindow(msgwindow, linecount=2)
msgwindow.height=32*linecount+msgwindow.borderY
msgwindow.y=(Graphics.height)-(msgwindow.height)
if $game_temp && $game_temp.in_battle && !$scene.respond_to?("update_basic")
msgwindow.y=0
elsif $game_system && $game_system.respond_to?("message_position")
case $game_system.message_position
when 0 msgwindow.y=0
when 1 msgwindow.y=(Graphics.height/2)-(msgwindow.height/2)
when 2
msgwindow.y=(Graphics.height)-(msgwindow.height)
end
end
if $game_system && $game_system.respond_to?("message_frame")
if $game_system.message_frame != 0
msgwindow.opacity = 0
end
end
if $game_message
case $game_message.background
when 1 msgwindow.opacity=0
when 2 msgwindow.opacity=0
end
end
end
|
#pbResetAllRoamers ⇒ Object
Resets all roaming Pokemon that were defeated without having been caught.
20
21
22
23
24
25
26
27
28
|
# File 'scripts/PField_RoamingPokemon.rb', line 20
def pbResetAllRoamers
if $PokemonGlobal && $PokemonGlobal.roamPokemon
for i in 0...$PokemonGlobal.roamPokemon.length
if $PokemonGlobal.roamPokemon[i]==true && $PokemonGlobal.roamPokemonCaught[i]!=true
$PokemonGlobal.roamPokemon[i]=nil
end
end
end
end
|
#pbResetCel(frame) ⇒ Object
#pbResolveAudioFile(str, volume = nil, pitch = nil) ⇒ Object
Converts an object to an audio file. str – Either a string showing the filename or an RPG::AudioFile object. Possible formats for str: filename volume and pitch 100 filename:volume pitch 100 filename:volume:pitch volume – Volume of the file, up to 100 pitch – Pitch of the file, normally 100
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'scripts/AudioPlay.rb', line 24
def pbResolveAudioFile(str,volume=nil,pitch=nil)
if str.is_a?(String)
str=pbStringToAudioFile(str)
str.volume=100
str.volume=volume if volume
str.pitch=100
str.pitch=pitch if pitch
end
if str.is_a?(RPG::AudioFile)
if volume || pitch
return RPG::AudioFile.new(str.name,
volume||str.volume||80,
pitch||str.pitch||100)
else
return str
end
end
return str
end
|
#pbResolveBitmap(x) ⇒ Object
Finds the real path for an image file. This includes paths in encrypted archives. Returns nil if the path can't be found.
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
|
# File 'scripts/SpriteWindow.rb', line 1397
def pbResolveBitmap(x)
return nil if !x
noext=x.gsub(/\.(bmp|png|gif|jpg|jpeg)$/,"")
filename=nil
RTP.eachPathFor(noext) {|path|
filename=pbTryString(path+".png") if !filename
filename=pbTryString(path+".gif") if !filename
}
return filename
end
|
#pbRestoreActivations(sprites, activeStatuses) ⇒ Object
Restores which windows are active for the given sprite hash. activeStatuses is the result of a previous call to pbActivateWindows
1297
1298
1299
1300
1301
1302
1303
1304
|
# File 'scripts/SpriteWindow.rb', line 1297
def pbRestoreActivations(sprites,activeStatuses)
return if !sprites || !activeStatuses
for k in activeStatuses.keys
if sprites[k] && sprites[k].is_a?(Window) && !pbDisposed?(sprites[k])
sprites[k].active=activeStatuses[k] ? true : false
end
end
end
|
#pbRestorePP(pokemon, move, pp) ⇒ Object
427
428
429
430
431
432
433
434
435
436
437
|
# File 'scripts/PItem_Items.rb', line 427
def pbRestorePP(pokemon,move,pp)
return 0 if pokemon.moves[move].id==0
return 0 if pokemon.moves[move].totalpp==0
newpp=pokemon.moves[move].pp+pp
if newpp>pokemon.moves[move].totalpp
newpp=pokemon.moves[move].totalpp
end
oldpp=pokemon.moves[move].pp
pokemon.moves[move].pp=newpp
return newpp-oldpp
end
|
#pbRestoreSpriteState(sprite, state) ⇒ Object
#pbRestoreSpriteStateAndBitmap(sprite, state) ⇒ Object
612
613
614
615
616
617
|
# File 'scripts/Pokemon_Evolution.rb', line 612
def pbRestoreSpriteStateAndBitmap(sprite,state)
return if !state || !sprite || sprite.disposed?
sprite.bitmap=state[SpriteMetafile::BITMAP]
pbRestoreSpriteState(sprite,state)
return state
end
|
#pbRgssChdir(dir) ⇒ Object
2887
2888
2889
|
# File 'scripts/BattleAnimationEditor.rb', line 2887
def pbRgssChdir(dir)
RTP.eachPathFor(dir){|path| Dir.chdir(path) { yield } }
end
|
#pbRgssExists?(filename) ⇒ Boolean
Used to determine whether a data file exists (rather than a graphics or audio file). Doesn't check RTP, but does check encrypted archives.
1761
1762
1763
1764
1765
1766
1767
1768
|
# File 'scripts/SpriteWindow.rb', line 1761
def pbRgssExists?(filename)
filename=canonicalize(filename)
if (safeExists?("./Game.rgssad") || safeExists?("./Game.rgss2a"))
return pbGetFileChar(filename)!=nil
else
return safeExists?(filename)
end
end
|
#pbRgssOpen(file, mode = nil) ⇒ Object
Opens an IO, even if the file is in an encrypted archive. Doesn't check RTP for the file.
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
|
# File 'scripts/SpriteWindow.rb', line 1772
def pbRgssOpen(file,mode=nil)
if !safeExists?("./Game.rgssad") && !safeExists?("./Game.rgss2a")
if block_given?
File.open(file,mode){|f| yield f }
return nil
else
return File.open(file,mode)
end
end
file=canonicalize(file)
Marshal.neverload=true
begin
str=load_data(file)
ensure
Marshal.neverload=false
end
if block_given?
StringInput.open(str){|f| yield f }
return nil
else
return StringInput.open(str)
end
end
|
#pbRoamingAreas(index) ⇒ Object
Gets the roaming areas for a particular Pokémon.
31
32
33
34
35
|
# File 'scripts/PField_RoamingPokemon.rb', line 31
def pbRoamingAreas(index)
data=RoamingSpecies[index]
return data[5] if data && data[5]
return RoamingAreas
end
|
#pbRoamingMethodAllowed(enctype) ⇒ Object
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
# File 'scripts/PField_RoamingPokemon.rb', line 229
def pbRoamingMethodAllowed(enctype)
encounter=$PokemonEncounters.pbEncounterType
case enctype
when 0 return true if encounter==EncounterTypes::Land
return true if encounter==EncounterTypes::LandMorning
return true if encounter==EncounterTypes::LandDay
return true if encounter==EncounterTypes::LandNight
return true if encounter==EncounterTypes::Water
return true if encounter==EncounterTypes::Cave
when 1 return true if encounter==EncounterTypes::Land
return true if encounter==EncounterTypes::LandMorning
return true if encounter==EncounterTypes::LandDay
return true if encounter==EncounterTypes::LandNight
return true if encounter==EncounterTypes::Cave
when 2 return true if encounter==EncounterTypes::Water
when 3 return true if encounter==EncounterTypes::OldRod
return true if encounter==EncounterTypes::GoodRod
return true if encounter==EncounterTypes::SuperRod
when 4 return true if encounter==EncounterTypes::Water
return true if encounter==EncounterTypes::OldRod
return true if encounter==EncounterTypes::GoodRod
return true if encounter==EncounterTypes::SuperRod
end
return false
end
|
#pbRoamingPokemonBattle(species, level) ⇒ Object
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
# File 'scripts/PField_RoamingPokemon.rb', line 126
def pbRoamingPokemonBattle(species,level)
index=$PokemonTemp.roamerIndex
if $PokemonGlobal.roamPokemon[index] &&
$PokemonGlobal.roamPokemon[index].is_a?(PokeBattle_Pokemon)
genwildpoke=$PokemonGlobal.roamPokemon[index]
else
genwildpoke=pbGenerateWildPokemon(species,level,true)
end
Events.onStartBattle.trigger(nil,genwildpoke)
scene=pbNewBattleScene
battle=PokeBattle_Battle.new(scene,$Trainer.party,[genwildpoke],$Trainer,nil)
battle.internalbattle=true
battle.cantescape=false
battle.rules["alwaysflee"]=true
pbPrepareBattle(battle)
decision=0
pbBattleAnimation(pbGetWildBattleBGM(species)) {
pbSceneStandby {
decision=battle.pbStartBattle
}
for i in $Trainer.party; (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); end
if $PokemonGlobal.partner
pbHealAll
for i in $PokemonGlobal.partner[3]
i.heal
i.makeUnmega rescue nil
i.makeUnprimal rescue nil
end
end
Events.onEndBattle.trigger(nil,decision,false)
}
Input.update
if decision==1 || decision==4 $PokemonGlobal.roamPokemon[index]=true
$PokemonGlobal.roamPokemonCaught[index]=(decision==4)
else
$PokemonGlobal.roamPokemon[index]=genwildpoke
end
$PokemonGlobal.roamEncounter=nil
$PokemonGlobal.roamedAlready=true
Events.onWildBattleEnd.trigger(nil,species,level,decision)
return (decision!=2 && decision!=5)
end
|
#pbRoamPokemon(ignoretrail = false) ⇒ Object
Roams all roamers, if their Switch is on.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'scripts/PField_RoamingPokemon.rb', line 46
def pbRoamPokemon(ignoretrail=false)
if !$PokemonGlobal.roamPosition
$PokemonGlobal.roamPosition={}
for i in 0...RoamingSpecies.length
species=getID(PBSpecies,RoamingSpecies[i][0])
next if !species || species<=0
keys=pbRoamingAreas(i).keys
$PokemonGlobal.roamPosition[i]=keys[rand(keys.length)]
end
end
$PokemonGlobal.roamHistory=[] if !$PokemonGlobal.roamHistory
$PokemonGlobal.roamPokemon=[] if !$PokemonGlobal.roamPokemon
for i in 0...RoamingSpecies.length
poke=RoamingSpecies[i]
if $game_switches[poke[2]]
species=getID(PBSpecies,poke[0])
next if !species || species<=0
choices=[]
keys=pbRoamingAreas(i).keys
currentArea=$PokemonGlobal.roamPosition[i]
if !currentArea
$PokemonGlobal.roamPosition[i]=keys[rand(keys.length)]
currentArea=$PokemonGlobal.roamPosition[i]
end
newAreas=pbRoamingAreas(i)[currentArea]
next if !newAreas
for area in newAreas
inhistory=$PokemonGlobal.roamHistory.include?(area)
inhistory=false if ignoretrail
choices.push(area) if !inhistory
end
if rand(32)==0 && keys.length>0
area=keys[rand(keys.length)]
inhistory=$PokemonGlobal.roamHistory.include?(area)
inhistory=false if ignoretrail
choices.push(area) if !inhistory
end
if choices.length>0
area=choices[rand(choices.length)]
$PokemonGlobal.roamPosition[i]=area
end
end
end
end
|
#pbRockSmashRandomEncounter ⇒ Object
#pbRuledBattle(team1, team2, rule) ⇒ Object
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 982
def pbRuledBattle(team1,team2,rule)
decision=0
if rand(100)!=0
party1=[]
party2=[]
team1.length.times {|i| party1.push(team1[i]) }
team2.length.times {|i| party2.push(team2[i]) }
decision=pbDecideWinner(party1,party2,team1.rating,team2.rating)
else
scene=PokeBattle_DebugSceneNoLogging.new
trainer1=PokeBattle_Trainer.new("PLAYER1",1)
trainer2=PokeBattle_Trainer.new("PLAYER2",1)
items1=[]
items2=[]
level=rule.ruleset.suggestedLevel
team1.length.times {|i|
p=team1[i]
if p.level!=level
p.level=level
p.calcStats
end
items1.push(p.item)
trainer1.party.push(p)
}
team2.length.times {|i|
p=team2[i]
if p.level!=level
p.level=level
p.calcStats
end
items2.push(p.item)
trainer2.party.push(p)
}
battle=rule.createBattle(scene,trainer1,trainer2)
battle.debug=true
battle.controlPlayer=true
battle.endspeech="..."
battle.internalbattle=false
decision=battle.pbStartBattle
team1.length.times {|i|
p=team1[i]
p.heal
p.setItem(items1[i])
}
team2.length.times {|i|
p=team2[i]
p.heal
p.setItem(items2[i])
}
end
if decision==1 team1.addMatch(team2,1)
team2.addMatch(team1,0)
elsif decision==2 team1.addMatch(team2,0)
team2.addMatch(team1,1)
else
team1.addMatch(team2,-1)
team2.addMatch(team1,-1)
end
end
|
#pbSafariBattle(species, level) ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'scripts/PBattle_Safari.rb', line 105
def pbSafariBattle(species,level)
genwildpoke=pbGenerateWildPokemon(species,level)
scene=pbNewBattleScene
battle=PokeBattle_SafariZone.new(scene,$Trainer,[genwildpoke])
battle.ballcount=pbSafariState.ballcount
battle.environment=pbGetEnvironment
decision=0
pbBattleAnimation(pbGetWildBattleBGM(species)) {
pbSceneStandby {
decision=battle.pbStartBattle
}
}
pbSafariState.ballcount=battle.ballcount
Input.update
if pbSafariState.ballcount<=0
if decision!=2 && decision!=5
Kernel.pbMessage(_INTL("Anunciador: ¡Te has quedado sin Safari Balls! ¡Fin del juego!"))
end
pbSafariState.decision=1
pbSafariState.pbGoToStart
end
Events.onWildBattleEnd.trigger(nil,species,level,decision)
return decision
end
|
#pbSafariState ⇒ Object
74
75
76
77
78
79
|
# File 'scripts/PBattle_Safari.rb', line 74
def pbSafariState
if !$PokemonGlobal.safariState
$PokemonGlobal.safariState=SafariState.new
end
return $PokemonGlobal.safariState
end
|
#pbSafeLoad(file) ⇒ Object
Loads data from a file “safely”, similar to load_data. If an encrypted archive exists, the real file is deleted to ensure that the file is loaded from the encrypted archive.
4
5
6
7
8
9
|
# File 'scripts/PSystem_System.rb', line 4
def pbSafeLoad(file)
if (safeExists?("./Game.rgssad") || safeExists?("./Game.rgss2a")) && safeExists?(file)
File.delete(file) rescue nil
end
return load_data(file)
end
|
#pbSameThread(wnd) ⇒ Object
1
2
3
4
5
6
7
8
9
|
# File 'scripts/PSystem_Controls.rb', line 1
def pbSameThread(wnd)
return false if wnd==0
processid=[0].pack('l')
getCurrentThreadId=Win32API.new('kernel32','GetCurrentThreadId', '%w()','l')
getWindowThreadProcessId=Win32API.new('user32','GetWindowThreadProcessId', '%w(l p)','l')
threadid=getCurrentThreadId.call
wndthreadid=getWindowThreadProcessId.call(wnd,processid)
return (wndthreadid==threadid)
end
|
#pbSave(safesave = false) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'scripts/PScreen_Save.rb', line 56
def pbSave(safesave=false)
$Trainer.metaID=$PokemonGlobal.playerID
begin
File.open(RTP.getSaveFileName("Game.rxdata"),"wb"){|f|
Marshal.dump($Trainer,f)
Marshal.dump(Graphics.frame_count,f)
if $data_system.respond_to?("magic_number")
$game_system.magic_number = $data_system.magic_number
else
$game_system.magic_number = $data_system.version_id
end
$game_system.save_count+=1
Marshal.dump($game_system,f)
Marshal.dump($PokemonSystem,f)
Marshal.dump($game_map.map_id,f)
Marshal.dump($game_switches,f)
Marshal.dump($game_variables,f)
Marshal.dump($game_self_switches,f)
Marshal.dump($game_screen,f)
Marshal.dump($MapFactory,f)
Marshal.dump($game_player,f)
$PokemonGlobal.safesave=safesave
Marshal.dump($PokemonGlobal,f)
Marshal.dump($PokemonMap,f)
Marshal.dump($PokemonBag,f)
Marshal.dump($PokemonStorage,f)
}
Graphics.frame_reset
rescue
return false
end
return true
end
|
#pbSaveAbilities ⇒ Object
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
|
# File 'scripts/Editor.rb', line 432
def pbSaveAbilities()
File.open("PBS/abilities.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 1..(PBAbilities.maxValue rescue PBAbilities.getCount-1 rescue pbGetMessageCount(MessageTypes::Abilities)-1)
abilname=getConstantName(PBAbilities,i) rescue pbGetAbilityConst(i)
next if !abilname || abilname==""
name=pbGetMessage(MessageTypes::Abilities,i)
next if !name || name==""
f.write(sprintf("%d,%s,%s,%s\r\n",i,
csvquote(abilname),
csvquote(name),
csvquote(pbGetMessage(MessageTypes::AbilityDescs,i))
))
end
}
end
|
#pbSaveBattlePokemon(btpokemon, filename) ⇒ Object
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
|
# File 'scripts/Editor.rb', line 898
def pbSaveBattlePokemon(btpokemon,filename)
return if !btpokemon || !filename
species={0=>""}
moves={0=>""}
items={0=>""}
natures={}
File.open(filename,"wb"){|f|
for i in 0...btpokemon.length
Graphics.update if i%500==0
pkmn=btpokemon[i]
f.write(pbFastInspect(pkmn,moves,species,items,natures))
f.write("\r\n")
end
}
end
|
#pbSaveBTTrainers(bttrainers, filename) ⇒ Object
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
|
# File 'scripts/Editor.rb', line 863
def pbSaveBTTrainers(bttrainers,filename)
return if !bttrainers || !filename
btTrainersRequiredTypes={
"Type"=>[0,"e",nil], "Name"=>[1,"s"],
"BeginSpeech"=>[2,"s"],
"EndSpeechWin"=>[3,"s"],
"EndSpeechLose"=>[4,"s"],
"PokemonNos"=>[5,"*u"]
}
File.open(filename,"wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 0...bttrainers.length
next if !bttrainers[i]
f.write(sprintf("[%03d]\r\n",i))
for key in btTrainersRequiredTypes.keys
schema=btTrainersRequiredTypes[key]
record=bttrainers[i][schema[0]]
next if record==nil
f.write(sprintf("%s=",key))
if key=="Type"
f.write((getConstantName(PBTrainers,record) rescue pbGetTrainerConst(record)))
elsif key=="PokemonNos"
f.write(record.join(",")) else
pbWriteCsvRecord(record,f,schema)
end
f.write(sprintf("\r\n"))
end
end
}
end
|
#pbSaveConnectionData ⇒ Object
689
690
691
692
693
|
# File 'scripts/Editor.rb', line 689
def pbSaveConnectionData
data=load_data("Data/connections.dat") rescue nil
return if !data
pbSerializeConnectionData(data,pbLoadRxData("Data/MapInfos"))
end
|
#pbSaveEncounterData ⇒ Object
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
|
# File 'scripts/Editor.rb', line 759
def pbSaveEncounterData()
encdata=load_data("Data/encounters.dat") rescue nil
return if !encdata
mapinfos=pbLoadRxData("Data/MapInfos")
File.open("PBS/encounters.txt","wb"){|f|
sortedkeys=encdata.keys.sort{|a,b| a<=>b}
for i in sortedkeys
if encdata[i]
e=encdata[i]
mapname=""
if mapinfos[i]
map=mapinfos[i].name
mapname=" # #{map}"
end
f.write(sprintf("#########################\r\n"))
f.write(sprintf("%03d%s\r\n",i,mapname))
f.write(sprintf("%d,%d,%d\r\n",e[0][EncounterTypes::Land],
e[0][EncounterTypes::Cave],e[0][EncounterTypes::Water]))
for j in 0...e[1].length
enc=e[1][j]
next if !enc
f.write(sprintf("%s\r\n",EncounterTypes::Names[j]))
for k in 0...EncounterTypes::EnctypeChances[j].length
encentry=(enc[k]) ? enc[k] : [1,5,5]
species=getConstantName(PBSpecies,encentry[0]) rescue pbGetSpeciesConst(encentry[0])
if encentry[1]==encentry[2]
f.write(sprintf("%s,%d\r\n",species,encentry[1]))
else
f.write(sprintf("%s,%d,%d\r\n",species,encentry[1],encentry[2]))
end
end
end
end
end
}
end
|
#pbSaveItems ⇒ Object
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
# File 'scripts/Editor.rb', line 451
def pbSaveItems
itemData=readItemList("Data/items.dat") rescue nil
return if !itemData || itemData.length==0
File.open("PBS/items.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 0...itemData.length
next if !itemData[i]
data=itemData[i]
cname=getConstantName(PBItems,i) rescue sprintf("ITEM%03d",i)
next if !cname || cname=="" || data[0]==0
machine=""
if data[ITEMMACHINE]>0
machine=getConstantName(PBMoves,data[ITEMMACHINE]) rescue pbGetMoveConst(data[ITEMMACHINE]) rescue ""
end
f.write(sprintf("%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n",
data[ITEMID],csvquote(cname),csvquote(data[ITEMNAME]),
csvquote(data[ITEMPLURAL]),data[ITEMPOCKET],data[ITEMPRICE],
csvquote(data[ITEMDESC]),data[ITEMUSE],data[ITEMBATTLEUSE],
data[ITEMTYPE],csvquote(machine)
))
end
}
end
|
#pbSaveMachines ⇒ Object
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
# File 'scripts/Editor.rb', line 523
def pbSaveMachines
machines=load_data("Data/tm.dat") rescue nil
return if !machines
File.open("PBS/tm.txt","wb"){|f|
for i in 1...machines.length
Graphics.update if i%50==0
next if !machines[i]
movename=getConstantName(PBMoves,i) rescue pbGetMoveConst(i) rescue nil
next if !movename || movename==""
f.write("\#-------------------\r\n")
f.write(sprintf("[%s]\r\n",movename))
x=[]
for j in 0...machines[i].length
speciesname=getConstantName(PBSpecies,machines[i][j]) rescue pbGetSpeciesConst(machines[i][j]) rescue nil
next if !speciesname || speciesname==""
x.push(speciesname)
end
f.write(x.join(",")+"\r\n")
end
}
end
|
724
725
726
727
728
|
# File 'scripts/Editor.rb', line 724
def pbSaveMetadata
data=load_data("Data/metadata.dat") rescue nil
return if !data
pbSerializeMetadata(data,pbLoadRxData("Data/MapInfos"))
end
|
#pbSaveMoveData ⇒ Object
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
# File 'scripts/Editor.rb', line 477
def pbSaveMoveData()
return if !pbRgssExists?("Data/moves.dat")
File.open("PBS/moves.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 1..(PBMoves.maxValue rescue PBMoves.getCount-1 rescue pbGetMessageCount(MessageTypes::Moves)-1)
moveconst=getConstantName(PBMoves,i) rescue pbGetMoveConst(i) rescue nil
next if !moveconst || moveconst==""
movename=pbGetMessage(MessageTypes::Moves,i)
movedata=PBMoveData.new(i)
flags=""
flags+="a" if (movedata.flags&0x00001)!=0
flags+="b" if (movedata.flags&0x00002)!=0
flags+="c" if (movedata.flags&0x00004)!=0
flags+="d" if (movedata.flags&0x00008)!=0
flags+="e" if (movedata.flags&0x00010)!=0
flags+="f" if (movedata.flags&0x00020)!=0
flags+="g" if (movedata.flags&0x00040)!=0
flags+="h" if (movedata.flags&0x00080)!=0
flags+="i" if (movedata.flags&0x00100)!=0
flags+="j" if (movedata.flags&0x00200)!=0
flags+="k" if (movedata.flags&0x00400)!=0
flags+="l" if (movedata.flags&0x00800)!=0
flags+="m" if (movedata.flags&0x01000)!=0
flags+="n" if (movedata.flags&0x02000)!=0
flags+="o" if (movedata.flags&0x04000)!=0
flags+="p" if (movedata.flags&0x08000)!=0
f.write(sprintf("%d,%s,%s,%03X,%d,%s,%s,%d,%d,%d,%02X,%d,%s,%s\r\n",
i,csvquote(moveconst),csvquote(movename),
movedata.function,
movedata.basedamage,
csvquote((getConstantName(PBTypes,movedata.type) rescue pbGetTypeConst(movedata.type) rescue "")),
csvquote(["Physical","Special","Status"][movedata.category]),
movedata.accuracy,
movedata.totalpp,
movedata.addlEffect,
movedata.target,
movedata.priority,
flags,
csvquote(pbGetMessage(MessageTypes::MoveDescriptions,i))
))
end
}
end
|
#pbSavePhoneData ⇒ Object
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
|
# File 'scripts/Editor.rb', line 819
def pbSavePhoneData
data=load_data("Data/phone.dat") rescue nil
return if !data
File.open("PBS/phone.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
f.write("[<Generics>]\r\n")
f.write(data.generics.join("\r\n")+"\r\n")
f.write("[<BattleRequests>]\r\n")
f.write(data.battleRequests.join("\r\n")+"\r\n")
f.write("[<GreetingsMorning>]\r\n")
f.write(data.greetingsMorning.join("\r\n")+"\r\n")
f.write("[<GreetingsEvening>]\r\n")
f.write(data.greetingsEvening.join("\r\n")+"\r\n")
f.write("[<Greetings>]\r\n")
f.write(data.greetings.join("\r\n")+"\r\n")
f.write("[<Bodies1>]\r\n")
f.write(data.bodies1.join("\r\n")+"\r\n")
f.write("[<Bodies2>]\r\n")
f.write(data.bodies2.join("\r\n")+"\r\n")
}
end
|
#pbSavePokemonData ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
|
# File 'scripts/Editor.rb', line 128
def pbSavePokemonData
dexdata=File.open("Data/dexdata.dat","rb") rescue nil
messages=Messages.new("Data/messages.dat") rescue nil
return if !dexdata || !messages
metrics=load_data("Data/metrics.dat") rescue nil
atkdata=File.open("Data/attacksRS.dat","rb")
eggEmerald=File.open("Data/eggEmerald.dat","rb")
regionaldata=File.open("Data/regionals.dat","rb")
numRegions=regionaldata.fgetw
numDexDatas=regionaldata.fgetw
pokedata=File.open("PBS/pokemon.txt","wb") rescue nil
pokedata.write(0xEF.chr)
pokedata.write(0xBB.chr)
pokedata.write(0xBF.chr)
for i in 1..(PBSpecies.maxValue rescue PBSpecies.getCount-1 rescue messages.getCount(MessageTypes::Species)-1)
cname=getConstantName(PBSpecies,i) rescue next
speciesname=messages.get(MessageTypes::Species,i)
kind=messages.get(MessageTypes::Kinds,i)
entry=messages.get(MessageTypes::Entries,i)
formnames=messages.get(MessageTypes::FormNames,i)
pbDexDataOffset(dexdata,i,2)
ability1=dexdata.fgetw
ability2=dexdata.fgetw
color=dexdata.fgetb
habitat=dexdata.fgetb
type1=dexdata.fgetb
type2=dexdata.fgetb
basestats=[]
for j in 0...6
basestats.push(dexdata.fgetb)
end
rareness=dexdata.fgetb
pbDexDataOffset(dexdata,i,18)
gender=dexdata.fgetb
happiness=dexdata.fgetb
growthrate=dexdata.fgetb
stepstohatch=dexdata.fgetw
effort=[]
for j in 0...6
effort.push(dexdata.fgetb)
end
pbDexDataOffset(dexdata,i,31)
compat1=dexdata.fgetb
compat2=dexdata.fgetb
height=dexdata.fgetw
weight=dexdata.fgetw
pbDexDataOffset(dexdata,i,38)
baseexp=dexdata.fgetw
hiddenability1=dexdata.fgetw
hiddenability2=dexdata.fgetw
hiddenability3=dexdata.fgetw
hiddenability4=dexdata.fgetw
item1=dexdata.fgetw
item2=dexdata.fgetw
item3=dexdata.fgetw
incense=dexdata.fgetw
pokedata.write("[#{i}]\r\nName=#{speciesname}\r\n")
pokedata.write("InternalName=#{cname}\r\n")
ctype1=getConstantName(PBTypes,type1) rescue pbGetTypeConst(type1) || pbGetTypeConst(0) || "NORMAL"
pokedata.write("Type1=#{ctype1}\r\n")
if type1!=type2
ctype2=getConstantName(PBTypes,type2) rescue pbGetTypeConst(type2) || pbGetTypeConst(0) || "NORMAL"
pokedata.write("Type2=#{ctype2}\r\n")
end
pokedata.write("BaseStats=#{basestats[0]},#{basestats[1]},#{basestats[2]},#{basestats[3]},#{basestats[4]},#{basestats[5]}\r\n")
case gender
when 0
pokedata.write("GenderRate=AlwaysMale\r\n")
when 31
pokedata.write("GenderRate=FemaleOneEighth\r\n")
when 63
pokedata.write("GenderRate=Female25Percent\r\n")
when 127
pokedata.write("GenderRate=Female50Percent\r\n")
when 191
pokedata.write("GenderRate=Female75Percent\r\n")
when 223
pokedata.write("GenderRate=FemaleSevenEighths\r\n")
when 254
pokedata.write("GenderRate=AlwaysFemale\r\n")
when 255
pokedata.write("GenderRate=Genderless\r\n")
end
pokedata.write("GrowthRate=" + ["Medium","Erratic","Fluctuating","Parabolic","Fast","Slow"][growthrate]+"\r\n")
pokedata.write("BaseEXP=#{baseexp}\r\n")
pokedata.write("EffortPoints=#{effort[0]},#{effort[1]},#{effort[2]},#{effort[3]},#{effort[4]},#{effort[5]}\r\n")
pokedata.write("Rareness=#{rareness}\r\n")
pokedata.write("Happiness=#{happiness}\r\n")
pokedata.write("Abilities=")
if ability1!=0
cability1=getConstantName(PBAbilities,ability1) rescue pbGetAbilityConst(ability1)
pokedata.write("#{cability1}")
pokedata.write(",") if ability2!=0
end
if ability2!=0
cability2=getConstantName(PBAbilities,ability2) rescue pbGetAbilityConst(ability2)
pokedata.write("#{cability2}")
end
pokedata.write("\r\n")
if hiddenability1>0 || hiddenability2>0 || hiddenability3>0 || hiddenability4>0
pokedata.write("HiddenAbility=")
needcomma=false
if hiddenability1>0
cabilityh=getConstantName(PBAbilities,hiddenability1) rescue pbGetAbilityConst(hiddenability1)
pokedata.write("#{cabilityh}"); needcomma=true
end
if hiddenability2>0
pokedata.write(",") if needcomma
cabilityh=getConstantName(PBAbilities,hiddenability2) rescue pbGetAbilityConst(hiddenability2)
pokedata.write("#{cabilityh}"); needcomma=true
end
if hiddenability3>0
pokedata.write(",") if needcomma
cabilityh=getConstantName(PBAbilities,hiddenability3) rescue pbGetAbilityConst(hiddenability3)
pokedata.write("#{cabilityh}"); needcomma=true
end
if hiddenability4>0
pokedata.write(",") if needcomma
cabilityh=getConstantName(PBAbilities,hiddenability4) rescue pbGetAbilityConst(hiddenability4)
pokedata.write("#{cabilityh}")
end
pokedata.write("\r\n")
end
pokedata.write("Moves=")
offset=atkdata.getOffset(i-1)
length=atkdata.getLength(i-1)>>1
atkdata.pos=offset
movelist=[]
for j in 0...length
alevel=atkdata.fgetw
move=atkdata.fgetw
movelist.push([j,alevel,move])
end
movelist.sort!{|a,b| a[1]==b[1] ? a[0]<=>b[0] : a[1]<=>b[1] }
for j in 0...movelist.length
alevel=movelist[j][1]
move=movelist[j][2]
pokedata.write(",") if j>0
cmove=getConstantName(PBMoves,move) rescue pbGetMoveConst(move)
pokedata.write(sprintf("%d,%s",alevel,cmove))
end
pokedata.write("\r\n")
eggEmerald.pos=(i-1)*8
offset=eggEmerald.fgetdw
length=eggEmerald.fgetdw
if length>0
pokedata.write("EggMoves=")
eggEmerald.pos=offset
first=true
j=0; loop do break unless j<length
atk=eggEmerald.fgetw
pokedata.write(",") if !first
break if atk==0
if atk>0
cmove=getConstantName(PBMoves,atk) rescue pbGetMoveConst(atk)
pokedata.write("#{cmove}")
first=false
end
j+=1
end
pokedata.write("\r\n")
end
comp1=getConstantName(PBEggGroups,compat1) rescue pbGetEggGroupConst(compat1)
comp2=getConstantName(PBEggGroups,compat2) rescue pbGetEggGroupConst(compat2)
if compat1==compat2
pokedata.write("Compatibility=#{comp1}\r\n")
else
pokedata.write("Compatibility=#{comp1},#{comp2}\r\n")
end
pokedata.write("StepsToHatch=#{stepstohatch}\r\n")
pokedata.write("Height=")
pokedata.write(sprintf("%.1f",height/10.0)) if height
pokedata.write("\r\n")
pokedata.write("Weight=")
pokedata.write(sprintf("%.1f",weight/10.0)) if weight
pokedata.write("\r\n")
colorname=getConstantName(PBColors,color) rescue pbGetColorConst(color)
pokedata.write("Color=#{colorname}\r\n")
pokedata.write("Habitat="+["","Grassland","Forest","WatersEdge","Sea","Cave","Mountain","RoughTerrain","Urban","Rare"][habitat]+"\r\n") if habitat>0
regionallist=[]
for region in 0...numRegions
regionaldata.pos=4+region*numDexDatas*2+(i*2)
regionallist.push(regionaldata.fgetw)
end
numb = regionallist.size-1
while (numb>=0) (regionallist[numb] == 0) ? regionallist.pop : break
numb-=1
end
if !regionallist.empty?
pokedata.write("RegionalNumbers="+regionallist[0].to_s)
for numb in 1...regionallist.size
pokedata.write(","+regionallist[numb].to_s)
end
pokedata.write("\r\n")
end
pokedata.write("Kind=#{kind}\r\n")
pokedata.write("Pokedex=#{entry}\r\n")
if formnames && formnames!=""
pokedata.write("FormNames=#{formnames}\r\n")
end
if item1>0
citem1=getConstantName(PBItems,item1) rescue pbGetItemConst(item1)
pokedata.write("WildItemCommon=#{citem1}\r\n")
end
if item2>0
citem2=getConstantName(PBItems,item2) rescue pbGetItemConst(item2)
pokedata.write("WildItemUncommon=#{citem2}\r\n")
end
if item3>0
citem3=getConstantName(PBItems,item3) rescue pbGetItemConst(item3)
pokedata.write("WildItemRare=#{citem3}\r\n")
end
if metrics
pokedata.write("BattlerPlayerY=#{metrics[0][i] || 0}\r\n")
pokedata.write("BattlerEnemyY=#{metrics[1][i] || 0}\r\n")
pokedata.write("BattlerAltitude=#{metrics[2][i] || 0}\r\n")
end
pokedata.write("Evolutions=")
count=0
for form in pbGetEvolvedFormData(i)
evonib=form[0]
level=form[1]
poke=form[2]
next if poke==0 || evonib==PBEvolution::Unknown
cpoke=getConstantName(PBSpecies,poke) rescue pbGetSpeciesConst(poke)
evoname=getConstantName(PBEvolution,evonib) rescue pbGetEvolutionConst(evonib)
next if !cpoke || cpoke==""
pokedata.write(",") if count>0
pokedata.write(sprintf("%s,%s,",cpoke,evoname))
case PBEvolution::EVOPARAM[evonib]
when 1
pokedata.write(_ISPRINTF("{1:d}",level))
when 2
clevel=getConstantName(PBItems,level) rescue pbGetItemConst(level)
pokedata.write("#{clevel}")
when 3
clevel=getConstantName(PBMoves,level) rescue pbGetMoveConst(level)
pokedata.write("#{clevel}")
when 4
clevel=getConstantName(PBSpecies,level) rescue pbGetSpeciesConst(level)
pokedata.write("#{clevel}")
when 5
clevel=getConstantName(PBTypes,level) rescue pbGetTypeConst(level)
pokedata.write("#{clevel}")
end
count+=1
end
pokedata.write("\r\n")
if incense>0
initem=getConstantName(PBItems,incense) rescue pbGetItemConst(incense)
pokedata.write("Incense=#{initem}\r\n")
end
if i%20==0
Graphics.update
Win32API.SetWindowText(_INTL("Procesando especies {1}...",i))
end
end
dexdata.close
atkdata.close
eggEmerald.close
regionaldata.close
pokedata.close
Graphics.update
end
|
#pbSaveShadowMoves ⇒ Object
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
|
# File 'scripts/Editor.rb', line 545
def pbSaveShadowMoves
moves=load_data("Data/shadowmoves.dat") rescue []
File.open("PBS/shadowmoves.txt","wb"){|f|
for i in 0...moves.length
move=moves[i]
if move && moves.length>0
constname=(getConstantName(PBSpecies,i) rescue pbGetSpeciesConst(i) rescue nil)
next if !constname
f.write(sprintf("%s=",constname))
movenames=[]
for m in move
movenames.push((getConstantName(PBMoves,m) rescue pbGetMoveConst(m) rescue nil))
end
f.write(sprintf("%s\r\n",movenames.compact.join(",")))
end
end
}
end
|
#pbSaveSpriteState(sprite) ⇒ Object
#pbSaveSpriteStateAndBitmap(sprite) ⇒ Object
605
606
607
608
609
610
|
# File 'scripts/Pokemon_Evolution.rb', line 605
def pbSaveSpriteStateAndBitmap(sprite)
return [] if !sprite || sprite.disposed?
state=pbSaveSpriteState(sprite)
state[SpriteMetafile::BITMAP]=sprite.bitmap
return state
end
|
#pbSaveTownMap ⇒ Object
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
|
# File 'scripts/Editor.rb', line 796
def pbSaveTownMap()
mapdata=load_data("Data/townmap.dat") rescue nil
return if !mapdata
File.open("PBS/townmap.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 0...mapdata.length
map=mapdata[i]
return if !map
f.write(sprintf("[%d]\r\n",i))
f.write(sprintf("Name=%s\r\nFilename=%s\r\n",
csvquote(map[0].is_a?(Array) ? map[0][0] : map[0]),
csvquote(map[1].is_a?(Array) ? map[1][0] : map[1])))
for loc in map[2]
f.write("Point=")
pbWriteCsvRecord(loc,f,[nil,"uussUUUU"])
f.write("\r\n")
end
end
}
end
|
#pbSaveTrainerBattles ⇒ Object
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
|
# File 'scripts/Editor.rb', line 592
def pbSaveTrainerBattles()
data=load_data("Data/trainers.dat") rescue nil
return if !data
File.open("PBS/trainers.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
f.write("\# "+_INTL("Consulta la documentación de la wiki para aprender a modificar este archivo."))
f.write("\r\n")
for trainer in data
trname=getConstantName(PBTrainers,trainer[0]) rescue pbGetTrainerConst(trainer[0]) rescue nil
next if !trname
f.write("\#-------------------\r\n")
f.write(sprintf("%s\r\n",trname))
trainername=trainer[1] ? trainer[1].gsub(/,/,";") : "???"
if trainer[4]==0
f.write(sprintf("%s\r\n",trainername))
else
f.write(sprintf("%s,%d\r\n",trainername,trainer[4]))
end
f.write(sprintf("%d",trainer[3].length))
for i in 0...8
itemname=getConstantName(PBItems,trainer[2][i]) rescue pbGetItemConst(trainer[2][i]) rescue nil
f.write(sprintf(",%s",itemname)) if trainer[2][i]
end
f.write("\r\n")
for poke in trainer[3]
maxindex=0
towrite=[]
thistemp=getConstantName(PBSpecies,poke[TPSPECIES]) rescue pbGetSpeciesConst(poke[TPSPECIES]) rescue ""
towrite[TPSPECIES]=thistemp
towrite[TPLEVEL]=poke[TPLEVEL].to_s
thistemp=getConstantName(PBItems,poke[TPITEM]) rescue pbGetItemConst(poke[TPITEM]) rescue ""
towrite[TPITEM]=thistemp
thistemp=getConstantName(PBMoves,poke[TPMOVE1]) rescue pbGetMoveConst(poke[TPMOVE1]) rescue ""
towrite[TPMOVE1]=thistemp
thistemp=getConstantName(PBMoves,poke[TPMOVE2]) rescue pbGetMoveConst(poke[TPMOVE2]) rescue ""
towrite[TPMOVE2]=thistemp
thistemp=getConstantName(PBMoves,poke[TPMOVE3]) rescue pbGetMoveConst(poke[TPMOVE3]) rescue ""
towrite[TPMOVE3]=thistemp
thistemp=getConstantName(PBMoves,poke[TPMOVE4]) rescue pbGetMoveConst(poke[TPMOVE4]) rescue ""
towrite[TPMOVE4]=thistemp
towrite[TPABILITY]=(poke[TPABILITY] ? poke[TPABILITY].to_s : "")
towrite[TPGENDER]=(poke[TPGENDER] ? ["M","F"][poke[TPGENDER]] : "")
towrite[TPFORM]=(poke[TPFORM] && poke[TPFORM]!=TPDEFAULTS[TPFORM] ? poke[TPFORM].to_s : "")
towrite[TPSHINY]=(poke[TPSHINY] ? "shiny" : "")
towrite[TPNATURE]=(poke[TPNATURE] ? getConstantName(PBNatures,poke[TPNATURE]) : "")
towrite[TPIV]=(poke[TPIV] && poke[TPIV]!=TPDEFAULTS[TPIV] ? poke[TPIV].to_s : "")
towrite[TPHAPPINESS]=(poke[TPHAPPINESS] && poke[TPHAPPINESS]!=TPDEFAULTS[TPHAPPINESS] ? poke[TPHAPPINESS].to_s : "")
towrite[TPNAME]=(poke[TPNAME] ? poke[TPNAME] : "")
towrite[TPSHADOW]=(poke[TPSHADOW] ? "true" : "")
towrite[TPBALL]=(poke[TPBALL] && poke[TPBALL]!=TPDEFAULTS[TPBALL] ? poke[TPBALL].to_s : "")
for i in 0...towrite.length
towrite[i]="" if !towrite[i]
maxindex=i if towrite[i] && towrite[i]!=""
end
for i in 0..maxindex
f.write(",") if i>0
f.write(towrite[i])
end
f.write("\r\n")
end
end
}
end
|
#pbSaveTrainerLists ⇒ Object
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
|
# File 'scripts/Editor.rb', line 843
def pbSaveTrainerLists()
trainerlists=load_data("Data/trainerlists.dat") rescue nil
return if !trainerlists
File.open("PBS/trainerlists.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for tr in trainerlists
f.write((tr[5] ? "[DefaultTrainerList]" : "[TrainerList]")+"\r\n")
f.write("Trainers="+tr[3]+"\r\n")
f.write("Pokemon="+tr[4]+"\r\n")
if !tr[5]
f.write("Challenges="+tr[2].join(",")+"\r\n")
end
pbSaveBTTrainers(tr[0],"PBS/"+tr[3])
pbSaveBattlePokemon(tr[1],"PBS/"+tr[4])
end
}
end
|
#pbSaveTrainerTypes ⇒ Object
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
|
# File 'scripts/Editor.rb', line 564
def pbSaveTrainerTypes()
data=load_data("Data/trainertypes.dat") rescue nil
return if !data
File.open("PBS/trainertypes.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
f.write("\# "+_INTL("Consulta la documentación de la wiki para aprender a modificar este archivo."))
f.write("\r\n")
for i in 0...data.length
record=data[i]
if record
dataline=sprintf("%d,%s,%s,%d,%s,%s,%s,%s,%s,%s\r\n",
i,record[1],record[2],
record[3],
record[4] ? record[4] : "",
record[5] ? record[5] : "",
record[6] ? record[6] : "",
record[7] ? ["Male","Female","Mixed"][record[7]] : "Mixed",
(record[8]!=record[3]) ? record[8] : "",
record[9] ? record[9] : ""
)
f.write(dataline)
end
end
}
end
|
#pbSaveTypes ⇒ Object
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
# File 'scripts/Editor.rb', line 394
def pbSaveTypes
return if (PBTypes.maxValue rescue 0)==0
File.open("PBS/types.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 0..(PBTypes.maxValue rescue 25)
name=PBTypes.getName(i) rescue nil
next if !name || name==""
constname=getConstantName(PBTypes,i) rescue pbGetTypeConst(i)
f.write(sprintf("[%d]\r\n",i))
f.write(sprintf("Name=%s\r\n",name))
f.write(sprintf("InternalName=%s\r\n",constname))
if (PBTypes.isPseudoType?(i) rescue isConst?(i,PBTypes,QMARKS))
f.write("IsPseudoType=true\r\n")
end
if (PBTypes.isSpecialType?(i) rescue pbIsOldSpecialType?(i))
f.write("IsSpecialType=true\r\n")
end
weak=[]
resist=[]
immune=[]
for j in 0..(PBTypes.maxValue rescue 25)
cname=getConstantName(PBTypes,j) rescue pbGetTypeConst(j)
next if !cname || cname==""
eff=PBTypes.getEffectiveness(j,i)
weak.push(cname) if eff==4
resist.push(cname) if eff==1
immune.push(cname) if eff==0
end
f.write("Weaknesses="+weak.join(",")+"\r\n") if weak.length>0
f.write("Resistances="+resist.join(",")+"\r\n") if resist.length>0
f.write("Immunities="+immune.join(",")+"\r\n") if immune.length>0
f.write("\r\n")
end
}
end
|
#pbSceneStandby ⇒ Object
473
474
475
476
477
478
479
480
481
482
483
|
# File 'scripts/PField_Field.rb', line 473
def pbSceneStandby
if $scene && $scene.is_a?(Scene_Map)
$scene.disposeSpritesets
end
GC.start
Graphics.frame_reset
yield
if $scene && $scene.is_a?(Scene_Map)
$scene.createSpritesets
end
end
|
#pbScreenCapture ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'scripts/PSystem_System.rb', line 95
def pbScreenCapture
capturefile=nil
5000.times {|i|
filename=RTP.getSaveFileName(sprintf("capture%03d.bmp",i))
if !safeExists?(filename)
capturefile=filename
break
end
i+=1
}
if capturefile && safeExists?("rubyscreen.dll")
takescreen=Win32API.new("rubyscreen.dll","TakeScreenshot","%w(p)","i")
takescreen.call(capturefile)
if safeExists?(capturefile)
pbSEPlay("expfull") if FileTest.audio_exist?("Audio/SE/expfull")
end
end
end
|
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
|
# File 'scripts/PField_Field.rb', line 2502
def pbScrollMap(direction, distance, speed)
return if !$game_map
if speed==0
case direction
when 2
$game_map.scroll_down(distance * 128)
when 4
$game_map.scroll_left(distance * 128)
when 6
$game_map.scroll_right(distance * 128)
when 8
$game_map.scroll_up(distance * 128)
end
else
$game_map.start_scroll(direction, distance, speed);
oldx=$game_map.display_x
oldy=$game_map.display_y
loop do
Graphics.update
Input.update
if !$game_map.scrolling?
break
end
pbUpdateSceneMap
if $game_map.display_x==oldx && $game_map.display_y==oldy
break
end
oldx=$game_map.display_x
oldy=$game_map.display_y
end
end
end
|
#pbSEFade(x = 0.0) ⇒ Object
220
|
# File 'scripts/AudioPlay.rb', line 220
def pbSEFade(x=0.0); pbSEStop(x);end
|
#pbSelectAnim(canvas, animwin) ⇒ Object
Pop-up menus for buttons in bottom menu
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
|
# File 'scripts/BattleAnimationEditor.rb', line 2728
def pbSelectAnim(canvas,animwin)
animfiles=[]
pbRgssChdir(".\\Graphics\\Animations\\") {
animfiles.concat(Dir.glob("*.png"))
}
cmdwin=pbListWindow(animfiles,320)
cmdwin.opacity=200
cmdwin.height=512
bmpwin=BitmapDisplayWindow.new(320,0,320,448)
ctlwin=ControlWindow.new(320,448,320,64)
cmdwin.viewport=canvas.viewport
bmpwin.viewport=canvas.viewport
ctlwin.viewport=canvas.viewport
ctlwin.addSlider(_INTL("Hue:"),0,359,0)
loop do
bmpwin.bitmapname=cmdwin.commands[cmdwin.index]
Graphics.update
Input.update
cmdwin.update
bmpwin.update
ctlwin.update
if ctlwin.changed?(0)
bmpwin.hue=ctlwin.value(0)
end
if (Input.trigger?(Input::C) || (cmdwin.doubleclick? rescue false)) && animfiles.length>0
bitmap=AnimatedBitmap.new("Graphics/Animations/"+cmdwin.commands[cmdwin.index],ctlwin.value(0)).deanimate
canvas.animation.graphic=cmdwin.commands[cmdwin.index]
canvas.animation.hue=ctlwin.value(0)
canvas.animbitmap=bitmap
animwin.animbitmap=bitmap
break
end
if Input.trigger?(Input::B)
break
end
end
bmpwin.dispose
cmdwin.dispose
ctlwin.dispose
return
end
|
#pbSelectBG(canvas, timing) ⇒ Object
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
|
# File 'scripts/BattleAnimationEditor.rb', line 2328
def pbSelectBG(canvas,timing)
filename=timing.name
cmdErase=-1
animfiles=[]
animfiles[cmdErase=animfiles.length]=_INTL("[Erase background graphic]")
ret=false
pbRgssChdir(".\\Graphics\\Animations\\") {
animfiles.concat(Dir.glob("*.bmp"))
animfiles.concat(Dir.glob("*.png"))
animfiles.concat(Dir.glob("*.jpg"))
animfiles.concat(Dir.glob("*.jpeg"))
animfiles.concat(Dir.glob("*.gif"))
}
cmdwin=pbListWindow(animfiles,320)
cmdwin.height=480
cmdwin.opacity=200
cmdwin.viewport=canvas.viewport
maxsizewindow=ControlWindow.new(320,0,320,32*11)
maxsizewindow.addLabel(_INTL("File: \"{1}\"",filename))
maxsizewindow.addSlider(_INTL("X:"),-500,500,timing.bgX || 0)
maxsizewindow.addSlider(_INTL("Y:"),-500,500,timing.bgY || 0)
maxsizewindow.addSlider(_INTL("Opacity:"),0,255,timing.opacity || 0)
maxsizewindow.addSlider(_INTL("Red:"),0,255,timing.colorRed || 0)
maxsizewindow.addSlider(_INTL("Green:"),0,255,timing.colorGreen || 0)
maxsizewindow.addSlider(_INTL("Blue:"),0,255,timing.colorBlue || 0)
maxsizewindow.addSlider(_INTL("Alpha:"),0,255,timing.colorAlpha || 0)
maxsizewindow.addButton(_INTL("Aceptar"))
maxsizewindow.addButton(_INTL("Salir"))
maxsizewindow.opacity=200
maxsizewindow.viewport=canvas.viewport
loop do
Graphics.update
Input.update
cmdwin.update
maxsizewindow.update
if maxsizewindow.changed?(8) timing.name=filename
timing.bgX=maxsizewindow.value(1)
timing.bgY=maxsizewindow.value(2)
timing.opacity=maxsizewindow.value(3)
timing.colorRed=maxsizewindow.value(4)
timing.colorGreen=maxsizewindow.value(5)
timing.colorBlue=maxsizewindow.value(6)
timing.colorAlpha=maxsizewindow.value(7)
ret=true
break
end
if maxsizewindow.changed?(9) break
end
if (Input.trigger?(Input::C) || (cmdwin.doubleclick? rescue false)) && animfiles.length>0
filename=(cmdwin.index==cmdErase) ? "" : cmdwin.commands[cmdwin.index]
maxsizewindow.controls[0].text=_INTL("File: \"{1}\"",filename)
elsif Input.trigger?(Input::B)
break
end
end
cmdwin.dispose
maxsizewindow.dispose
return ret
end
|
#pbSelectSE(canvas, audio) ⇒ Object
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
|
# File 'scripts/BattleAnimationEditor.rb', line 2267
def pbSelectSE(canvas,audio)
filename=(audio.name!="") ? audio.name : ""
displayname=(filename!="") ? filename : _INTL("<user's cry>")
cmdNone=-1
animfiles=[]
animfiles[cmdNone=animfiles.length]=_INTL("[Play user's cry]")
ret=false
pbRgssChdir(".\\Audio\\SE\\") {
animfiles.concat(Dir.glob("*.wav"))
animfiles.concat(Dir.glob("*.mp3"))
animfiles.concat(Dir.glob("*.ogg"))
animfiles.concat(Dir.glob("*.wma"))
}
cmdwin=pbListWindow(animfiles,320)
cmdwin.height=480
cmdwin.opacity=200
cmdwin.viewport=canvas.viewport
maxsizewindow=ControlWindow.new(320,0,320,32*8)
maxsizewindow.addLabel(_INTL("File: \"{1}\"",displayname))
maxsizewindow.addSlider(_INTL("Volume:"),0,100,audio.volume)
maxsizewindow.addSlider(_INTL("Pitch:"),20,250,audio.pitch)
maxsizewindow.addButton(_INTL("Play Sound"))
maxsizewindow.addButton(_INTL("Stop Sound"))
maxsizewindow.addButton(_INTL("Aceptar"))
maxsizewindow.addButton(_INTL("Salir"))
maxsizewindow.opacity=200
maxsizewindow.viewport=canvas.viewport
loop do
Graphics.update
Input.update
cmdwin.update
maxsizewindow.update
if maxsizewindow.changed?(3) && animfiles.length>0 pbSEPlay(RPG::AudioFile.new(filename,maxsizewindow.value(1),maxsizewindow.value(2)))
end
if maxsizewindow.changed?(4) && animfiles.length>0 pbSEStop()
end
if maxsizewindow.changed?(5) audio.name=filename
audio.volume=maxsizewindow.value(1)
audio.pitch=maxsizewindow.value(2)
ret=true
break
end
if maxsizewindow.changed?(6) break
end
if (Input.trigger?(Input::C) || (cmdwin.doubleclick? rescue false)) && animfiles.length>0
filename=(cmdwin.index==cmdNone) ? "" : cmdwin.commands[cmdwin.index]
displayname=(filename!="") ? filename : _INTL("<user's cry>")
maxsizewindow.controls[0].text=_INTL("File: \"{1}\"",displayname)
elsif Input.trigger?(Input::B)
break
end
end
cmdwin.dispose
maxsizewindow.dispose
return ret
end
|
#pbSellTriads ⇒ Object
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
|
# File 'scripts/PMinigame_TripleTriad.rb', line 1163
def pbSellTriads
commands=[]
for i in 0...$PokemonGlobal.triads.length
item=$PokemonGlobal.triads[i]
speciesname=PBSpecies.getName(item[0])
commands.push(_INTL("{1} x{2}",speciesname,item[1]))
end
commands.push(_INTL("CANCEL"))
if commands.length==1
Kernel.pbMessage(_INTL("You have no cards."))
return
end
pbScrollMap(4,3,5)
cmdwindow=Window_CommandPokemonEx.newWithSize(commands,0,0,256,Graphics.height)
cmdwindow.z=99999
moneyString=_INTL("${1}",$Trainer.money)
goldwindow=Window_UnformattedTextPokemon.newWithSize(
_INTL("Money:\n{1}",moneyString),0,0,32,32)
goldwindow.resizeToFit(goldwindow.text,Graphics.width)
goldwindow.y=0
goldwindow.x=Graphics.width-goldwindow.width
goldwindow.z=99999
done=false
Graphics.frame_reset
while !done
loop do
Graphics.update
Input.update
cmdwindow.active=true
cmdwindow.update
goldwindow.update
if Input.trigger?(Input::B)
done=true
break
end
if Input.trigger?(Input::C)
if cmdwindow.index>=$PokemonGlobal.triads.length
done=true
break
end
item=$PokemonGlobal.triads.getItem(cmdwindow.index)
itemname=PBSpecies.getName(item)
quantity=$PokemonGlobal.triads.pbQuantity(item)
price=TriadCard.new(item).price
if price==0
pbDisplayPaused(_INTL("The {1} card? Oh, no.\r\nI can't buy that.",itemname))
break
end
cmdwindow.active=false
cmdwindow.update
if quantity>1
params=ChooseNumberParams.new
params.setRange(1,quantity)
params.setInitialValue(1)
params.setCancelValue(0)
quantity=Kernel.pbMessageChooseNumber(
_INTL("The {1} card? How many would you like to sell?",itemname),params)
end
if quantity>0
price/=4
price*=quantity
if Kernel.pbConfirmMessage(_INTL("I can pay ${1}. Would that be OK?",price))
$Trainer.money+=price
moneyString=_INTL("${1}",$Trainer.money)
goldwindow.text=_INTL("Money:\n{1}",moneyString)
$PokemonGlobal.triads.pbDeleteItem(item,quantity)
Kernel.pbMessage(_INTL("Turned over the {1} card and received ${2}.",itemname,price))
commands=[]
for i in 0...$PokemonGlobal.triads.length
item=$PokemonGlobal.triads[i]
speciesname=PBSpecies.getName(item[0])
commands.push(_INTL("{1} x{2}",speciesname,item[1]))
end
commands.push(_INTL("CANCEL"))
cmdwindow.commands=commands
break
end
end
end
end
end
cmdwindow.dispose
goldwindow.dispose
Graphics.frame_reset
pbScrollMap(6,3,5)
end
|
#pbSEPlay(param, volume = nil, pitch = nil) ⇒ Object
Plays an SE file. param – Either a string showing the filename (relative to Audio/SE/) or an RPG::AudioFile object. Possible formats for param: filename volume and pitch 100 filename:volume pitch 100 filename:volume:pitch volume – Volume of the file, up to 100 pitch – Pitch of the file, normally 100
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# File 'scripts/AudioPlay.rb', line 202
def pbSEPlay(param,volume=nil,pitch=nil)
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
if $game_system && $game_system.respond_to?("se_play")
$game_system.se_play(param)
return
elsif (RPG.const_defined?(:SE) rescue false)
b=RPG::SE.new(param.name,param.volume,param.pitch)
if b && b.respond_to?("play")
b.play; return
end
end
Audio.se_play(canonicalize("Audio/SE/"+param.name),param.volume,param.pitch)
end
end
|
#pbSerializeConnectionData(conndata, mapinfos) ⇒ Object
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
|
# File 'scripts/Editor.rb', line 695
def pbSerializeConnectionData(conndata,mapinfos)
File.open("PBS/connections.txt","wb"){|f|
for conn in conndata
if mapinfos
next if !mapinfos[conn[0]] || !mapinfos[conn[3]]
f.write(sprintf("# %s (%d) - %s (%d)\r\n",
mapinfos[conn[0]] ? mapinfos[conn[0]].name : "???",conn[0],
mapinfos[conn[3]] ? mapinfos[conn[3]].name : "???",conn[3]))
end
if conn[1].is_a?(String) || conn[4].is_a?(String)
f.write(sprintf("%d,%s,%d,%d,%s,%d\r\n",conn[0],conn[1],
conn[2],conn[3],conn[4],conn[5]))
else
ret=normalizeConnectionPoint(conn)
f.write(writeConnectionPoint(
ret[0],
ret[1],
ret[2],
ret[3],
ret[4],
ret[5]
))
end
end
}
save_data(conndata,"Data/connections.dat")
end
|
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
|
# File 'scripts/Editor.rb', line 730
def pbSerializeMetadata(metadata,mapinfos)
save_data(metadata,"Data/metadata.dat")
File.open("PBS/metadata.txt","wb"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
for i in 0...metadata.length
next if !metadata[i]
f.write(sprintf("[%03d]\r\n",i))
if i==0
types=PokemonMetadata::GlobalTypes
else
if mapinfos && mapinfos[i]
f.write(sprintf("# %s\r\n",mapinfos[i].name))
end
types=PokemonMetadata::NonGlobalTypes
end
for key in types.keys
schema=types[key]
record=metadata[i][schema[0]]
next if record==nil
f.write(sprintf("%s=",key))
pbWriteCsvRecord(record,f,schema)
f.write(sprintf("\r\n"))
end
end
}
end
|
#pbSEStop(timeInSeconds = 0.0) ⇒ Object
223
224
225
226
227
228
229
230
231
|
# File 'scripts/AudioPlay.rb', line 223
def pbSEStop(timeInSeconds=0.0)
if $game_system
$game_system.se_stop
elsif (RPG.const_defined?(:SE) rescue false)
RPG::SE.stop rescue nil
else
Audio.se_stop
end
end
|
#pbSetEscapePoint ⇒ Object
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
|
# File 'scripts/PField_Field.rb', line 1849
def pbSetEscapePoint
$PokemonGlobal.escapePoint=[] if !$PokemonGlobal.escapePoint
xco=$game_player.x
yco=$game_player.y
case $game_player.direction
when 2 yco-=1; dir=8
when 4 xco+=1; dir=6
when 6 xco-=1; dir=4
when 8 yco+=1; dir=2
end
$PokemonGlobal.escapePoint=[$game_map.map_id,xco,yco,dir]
end
|
#pbSetFlash(cel, previewsprite) ⇒ Object
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
|
# File 'scripts/BattleAnimationEditor.rb', line 2000
def pbSetFlash(cel,previewsprite)
sliderwin2=ControlWindow.new(0,0,320,320)
sliderwin2.z=99999
sliderwin2.addSlider(_INTL("Rojo:"),0,255,cel[AnimFrame::COLORRED])
sliderwin2.addSlider(_INTL("Verde:"),0,255,cel[AnimFrame::COLORGREEN])
sliderwin2.addSlider(_INTL("Azul:"),0,255,cel[AnimFrame::COLORBLUE])
sliderwin2.addSlider(_INTL("Alfa:"),0,255,cel[AnimFrame::COLORALPHA])
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
loop do
previewsprite.tone.set(
sliderwin2.value(0),
sliderwin2.value(1),
sliderwin2.value(2),
sliderwin2.value(3)
)
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
cel[AnimFrame::COLORRED]=sliderwin2.value(0)
cel[AnimFrame::COLORGREEN]=sliderwin2.value(1)
cel[AnimFrame::COLORBLUE]=sliderwin2.value(2)
cel[AnimFrame::COLORALPHA]=sliderwin2.value(3)
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
return
end
|
#pbSetLotteryNumber(variable = 1) ⇒ Object
“Lottery” mini-game By Maruno
5
6
7
8
9
10
11
12
|
# File 'scripts/PMinigame_Lottery.rb', line 5
def pbSetLotteryNumber(variable=1)
t = pbGetTimeNow
hash = t.day + (t.month << 5) + (t.year << 9)
srand(hash) lottery = rand(65536) srand pbSet(variable,sprintf("%05d",lottery))
end
|
#pbSetNarrowFont(bitmap) ⇒ Object
Sets a bitmap's font to the system narrow font.
1491
1492
1493
1494
|
# File 'scripts/SpriteWindow.rb', line 1491
def pbSetNarrowFont(bitmap)
bitmap.font.name=pbNarrowFontName()
bitmap.font.size=31
end
|
#pbSetReadyToBattle(num) ⇒ Object
167
168
169
170
171
172
173
|
# File 'scripts/PScreen_Phone.rb', line 167
def pbSetReadyToBattle(num)
if num[6] && num[7]
$game_self_switches[[num[6],num[7],"A"]]=false
$game_self_switches[[num[6],num[7],"B"]]=true
$game_map.need_refresh=true
end
end
|
#pbSetResizeFactor(factor = 1, norecalc = false) ⇒ Object
28
|
# File 'scripts/PSystem_System.rb', line 28
def pbSetResizeFactor(dummy,dummy2=false); end
|
#pbSetResizeFactor2(factor, force = false) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'scripts/Sprite_Resizer.rb', line 24
def pbSetResizeFactor2(factor,force=false)
if $ResizeFactor!=factor || force
$ResizeFactor=factor
$ResizeFactorMul=(factor*100).to_i
if $ResizeFactorSet!=false
ObjectSpace.each_object(Sprite){|o|
next if o.disposed?
o.x=o.x
o.y=o.y
o.ox=o.ox
o.oy=o.oy
o.zoom_x=o.zoom_x
o.zoom_y=o.zoom_y
}
ObjectSpace.each_object(Viewport){|o|
begin
o.rect=o.rect
o.ox=o.ox
o.oy=o.oy
rescue RGSSError
end
}
ObjectSpace.each_object(Plane){|o|
next if o.disposed?
o.zoom_x=o.zoom_x
o.zoom_y=o.zoom_y
}
end
end
$ResizeFactorSet=true
if $HaveResizeBorder
$ResizeBorder.refresh
end
begin
if Graphics.haveresizescreen
Graphics.oldresizescreen(
(Graphics.width+$ResizeOffsetX*2)*factor,
(Graphics.height+$ResizeOffsetY*2)*factor
)
end
Win32API.SetWindowPos(
(Graphics.width+$ResizeOffsetX*2)*factor,
(Graphics.height+$ResizeOffsetY*2)*factor
)
rescue
end
end
|
#pbSetSmallFont(bitmap) ⇒ Object
Sets a bitmap's font to the system small font.
1485
1486
1487
1488
|
# File 'scripts/SpriteWindow.rb', line 1485
def pbSetSmallFont(bitmap)
bitmap.font.name=pbSmallFontName()
bitmap.font.size=25
end
|
#pbSetSpritesToColor(sprites, color) ⇒ Object
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
|
# File 'scripts/SpriteWindow.rb', line 1367
def pbSetSpritesToColor(sprites,color)
return if !sprites || !color
colors={}
for i in sprites
next if !i[1] || pbDisposed?(i[1])
colors[i[0]]=i[1].color.clone
i[1].color=pbSrcOver(i[1].color,color)
end
Graphics.update
Input.update
for i in colors
next if !sprites[i[0]]
sprites[i[0]].color=i[1]
end
end
|
#pbSetSystemFont(bitmap) ⇒ Object
Sets a bitmap's font to the system font.
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
|
# File 'scripts/SpriteWindow.rb', line 1460
def pbSetSystemFont(bitmap)
fontname=MessageConfig.pbGetSystemFontName()
bitmap.font.name=fontname
if fontname=="Pokemon FireLeaf" || fontname=="Power Red and Green"
bitmap.font.size=29
elsif fontname=="Pokemon Emerald Small" || fontname=="Power Green Small"
bitmap.font.size=25
else
bitmap.font.size=31
end
end
|
#pbSetTextMessages ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'scripts/Intl_Messages.rb', line 22
def pbSetTextMessages
Graphics.update
begin
t = Time.now.to_i
texts=[]
for script in $RGSS_SCRIPTS
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
scr=Zlib::Inflate.inflate(script[2])
pbAddRgssScriptTexts(texts,scr)
end
MessageTypes.addMessagesAsHash(MessageTypes::ScriptTexts,texts)
commonevents=pbLoadRxData("Data/CommonEvents")
items=[]
choices=[]
for event in commonevents.compact
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
begin
neednewline=false
lastitem=""
for j in 0...event.list.size
list = event.list[j]
if neednewline && list.code!=401
if lastitem!=""
lastitem.gsub!(/([^\.\!\?])\s\s+/){|m| $1+" "}
items.push(lastitem)
lastitem=""
end
neednewline=false
end
if list.code == 101
lastitem+="#{list.parameters[0]}" if !$RPGVX
neednewline=true
elsif list.code == 102
for k in 0...list.parameters[0].length
choices.push(list.parameters[0][k])
end
neednewline=false
elsif list.code == 401
lastitem+=" " if lastitem!=""
lastitem+="#{list.parameters[0]}"
neednewline=true
elsif list.code == 355 || list.code == 655
pbAddScriptTexts(items,list.parameters[0])
elsif list.code == 111 && list.parameters[0]==12
pbAddScriptTexts(items,list.parameters[1])
elsif list.code == 209
route=list.parameters[1]
for k in 0...route.list.size
if route.list[k].code == 45
pbAddScriptTexts(items,route.list[k].parameters[0])
end
end
end
end
if neednewline
if lastitem!=""
items.push(lastitem)
lastitem=""
end
end
end
end
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
items|=[]
choices|=[]
items.concat(choices)
MessageTypes.setMapMessagesAsHash(0,items)
mapinfos = pbLoadRxData("Data/MapInfos")
mapnames=[]
for id in mapinfos.keys
mapnames[id]=mapinfos[id].name
end
MessageTypes.setMessages(MessageTypes::MapNames,mapnames)
for id in mapinfos.keys
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
filename=sprintf("Data/Map%03d.%s",id,$RPGVX ? "rvdata" : "rxdata")
next if !pbRgssExists?(filename)
map = load_data(filename)
items=[]
choices=[]
for event in map.events.values
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
begin
for i in 0...event.pages.size
neednewline=false
lastitem=""
for j in 0...event.pages[i].list.size
list = event.pages[i].list[j]
if neednewline && list.code!=401
if lastitem!=""
lastitem.gsub!(/([^\.\!\?])\s\s+/){|m| $1+" "}
items.push(lastitem)
lastitem=""
end
neednewline=false
end
if list.code == 101
lastitem+="#{list.parameters[0]}" if !$RPGVX
neednewline=true
elsif list.code == 102
for k in 0...list.parameters[0].length
choices.push(list.parameters[0][k])
end
neednewline=false
elsif list.code == 401
lastitem+=" " if lastitem!=""
lastitem+="#{list.parameters[0]}"
neednewline=true
elsif list.code == 355 || list.code==655
pbAddScriptTexts(items,list.parameters[0])
elsif list.code == 111 && list.parameters[0]==12
pbAddScriptTexts(items,list.parameters[1])
elsif list.code==209
route=list.parameters[1]
for k in 0...route.list.size
if route.list[k].code==45
pbAddScriptTexts(items,route.list[k].parameters[0])
end
end
end
end
if neednewline
if lastitem!=""
items.push(lastitem)
lastitem=""
end
end
end
end
end
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
items|=[]
choices|=[]
items.concat(choices)
MessageTypes.setMapMessagesAsHash(id,items)
if Time.now.to_i - t >= 5
t = Time.now.to_i
Graphics.update
end
end
rescue Hangup
end
Graphics.update
end
|
#pbSettingToTextSpeed(speed) ⇒ Object
318
319
320
321
322
323
324
|
# File 'scripts/PScreen_Options.rb', line 318
def pbSettingToTextSpeed(speed)
return 2 if speed==0
return 1 if speed==1
return -2 if speed==2
return MessageConfig::TextSpeed if MessageConfig::TextSpeed
return ((Graphics.frame_rate>40) ? -2 : 1)
end
|
#pbSetTone(cel, previewsprite) ⇒ Object
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
|
# File 'scripts/BattleAnimationEditor.rb', line 1966
def pbSetTone(cel,previewsprite)
sliderwin2=ControlWindow.new(0,0,320,320)
sliderwin2.z=99999
sliderwin2.addSlider(_INTL("Red Offset:"),-255,255,cel[AnimFrame::TONERED])
sliderwin2.addSlider(_INTL("Green Offset:"),-255,255,cel[AnimFrame::TONEGREEN])
sliderwin2.addSlider(_INTL("Blue Offset:"),-255,255,cel[AnimFrame::TONEBLUE])
sliderwin2.addSlider(_INTL("Gray Tone:"),0,255,cel[AnimFrame::TONEGRAY])
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
loop do
previewsprite.tone.set(
sliderwin2.value(0),
sliderwin2.value(1),
sliderwin2.value(2),
sliderwin2.value(3)
)
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton)
cel[AnimFrame::TONERED]=sliderwin2.value(0)
cel[AnimFrame::TONEGREEN]=sliderwin2.value(1)
cel[AnimFrame::TONEBLUE]=sliderwin2.value(2)
cel[AnimFrame::TONEGRAY]=sliderwin2.value(3)
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
return
end
|
#pbSetUpSystem ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'scripts/PSystem_System.rb', line 47
def pbSetUpSystem
begin
trainer=nil
framecount=0
havedata=false
game_system=nil
pokemonSystem=nil
File.open(RTP.getSaveFileName("Game.rxdata")){|f|
trainer=Marshal.load(f)
framecount=Marshal.load(f)
game_system=Marshal.load(f)
pokemonSystem=Marshal.load(f)
}
raise "Corrupted file" if !trainer.is_a?(PokeBattle_Trainer)
raise "Corrupted file" if !framecount.is_a?(Numeric)
raise "Corrupted file" if !game_system.is_a?(Game_System)
raise "Corrupted file" if !pokemonSystem.is_a?(PokemonSystem)
havedata=true
rescue
pokemonSystem=PokemonSystem.new
game_system=Game_System.new
end
if !$INEDITOR
$PokemonSystem=pokemonSystem
$game_system=Game_System
pbSetResizeFactor($PokemonSystem.screensize)
else
pbSetResizeFactor(1.0)
end
begin
consts=pbSafeLoad("Data/Constants.rxdata")
consts=[] if !consts
rescue
consts=[]
end
for script in consts
next if !script
eval(Zlib::Inflate.inflate(script[2]),nil,script[1])
end
if LANGUAGES.length>=2
if !havedata
pokemonSystem.language=pbChooseLanguage
end
pbLoadMessages("Data/"+LANGUAGES[pokemonSystem.language][1])
end
end
|
#pbShake(power, speed, frames) ⇒ Object
2494
2495
2496
|
# File 'scripts/PField_Field.rb', line 2494
def pbShake(power,speed,frames)
$game_screen.start_shake(power,speed,frames * 2)
end
|
#pbShowMap(region = -1,, wallmap = true) ⇒ Object
373
374
375
376
377
378
379
|
# File 'scripts/PScreen_RegionMap.rb', line 373
def pbShowMap(region=-1,wallmap=true)
pbFadeOutIn(99999) {
scene=PokemonRegionMapScene.new(region,wallmap)
screen=PokemonRegionMap.new(scene)
screen.pbStartScreen
}
end
|
#pbSlotMachine(difficulty = 1) ⇒ Object
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
# File 'scripts/PMinigame_SlotMachine.rb', line 404
def pbSlotMachine(difficulty=1)
if hasConst?(PBItems,:COINCASE) && $PokemonBag.pbQuantity(:COINCASE)<=0
Kernel.pbMessage(_INTL("Es una máquina tragaperras."))
elsif $PokemonGlobal.coins==0
Kernel.pbMessage(_INTL("¡No tienes fichas para jugar!"))
elsif $PokemonGlobal.coins==MAXCOINS
Kernel.pbMessage(_INTL("¡Tu Caja de Fichas está llena!"))
else
scene=SlotMachineScene.new
screen=SlotMachine.new(scene)
pbFadeOutIn(99999) {
screen.pbStartScreen(difficulty)
}
end
end
|
#pbSmallFontName ⇒ Object
Gets the name of the system small font.
1473
1474
1475
1476
|
# File 'scripts/SpriteWindow.rb', line 1473
def pbSmallFontName()
return MessageConfig.pbTryFonts("Power Green Small","Pokemon Emerald Small",
"Arial Narrow","Arial")
end
|
#pbSpeciesCompatible?(species, move) ⇒ Boolean
504
505
506
507
508
509
510
|
# File 'scripts/PItem_Items.rb', line 504
def pbSpeciesCompatible?(species,move)
ret=false
return false if species<=0
data=load_data("Data/tm.dat")
return false if !data[move]
return data[move].any? {|item| item==species }
end
|
#pbSpriteHitTest(sprite, x, y, usealpha = true, wholecanvas = false) ⇒ Object
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
|
# File 'scripts/BattleAnimationEditor.rb', line 1042
def pbSpriteHitTest(sprite,x,y,usealpha=true,wholecanvas=false)
return false if !sprite || sprite.disposed?
return false if !sprite.bitmap
return false if !sprite.visible
return false if sprite.bitmap.disposed?
width=sprite.src_rect.width
height=sprite.src_rect.height
if !wholecanvas
xwidth=width-128
xheight=height-128
width=128 if width>128 && !usealpha
height=128 if height>128 && !usealpha
else
xwidth=0
xheight=0
end
width=sprite.bitmap.width if width>sprite.bitmap.width
height=sprite.bitmap.height if height>sprite.bitmap.height
if usealpha
spritex=sprite.x-(sprite.ox*sprite.zoom_x)
spritey=sprite.y-(sprite.oy*sprite.zoom_y)
width*=sprite.zoom_x
height*=sprite.zoom_y
else
spritex=sprite.x-sprite.ox
spritey=sprite.y-sprite.oy
spritex+=xwidth/2
spritey+=xheight/2
end
if !(x>=spritex && x<=spritex+width && y>=spritey && y<=spritey+height)
return false
end
if usealpha
bitmapX=sprite.src_rect.x
bitmapY=sprite.src_rect.y
bitmapX+=sprite.ox
bitmapY+=sprite.oy
bitmapX+=(x-sprite.x)/sprite.zoom_x if sprite.zoom_x>0
bitmapY+=(y-sprite.y)/sprite.zoom_y if sprite.zoom_y>0
bitmapX=bitmapX.round
bitmapY=bitmapY.round
if sprite.mirror
xmirror=bitmapX-sprite.src_rect.x
bitmapX=sprite.src_rect.x+192-xmirror
end
color=sprite.bitmap.get_pixel(bitmapX,bitmapY)
return false if (color.alpha==0)
end
return true
end
|
#pbSpriteSetAnimFrame(sprite, frame, user = nil, target = nil, ineditor = false) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 130
def pbSpriteSetAnimFrame(sprite,frame,user=nil,target=nil,ineditor=false)
return if !sprite
if !frame
sprite.visible=false
sprite.src_rect=Rect.new(0,0,1,1)
return
end
sprite.blend_type=frame[AnimFrame::BLENDTYPE]
sprite.angle=frame[AnimFrame::ANGLE]
sprite.mirror=(frame[AnimFrame::MIRROR]>0)
sprite.opacity=frame[AnimFrame::OPACITY]
sprite.visible=true
if !frame[AnimFrame::VISIBLE]==1 && ineditor
sprite.opacity/=2
else
sprite.visible=(frame[AnimFrame::VISIBLE]==1)
end
pattern=frame[AnimFrame::PATTERN]
if pattern>=0
animwidth=192
sprite.src_rect.set((pattern%5)*animwidth,(pattern/5)*animwidth,
animwidth,animwidth)
else
sprite.src_rect.set(0,0,
sprite.bitmap ? sprite.bitmap.width : 128,
sprite.bitmap ? sprite.bitmap.height : 128)
end
sprite.zoom_x=frame[AnimFrame::ZOOMX]/100.0
sprite.zoom_y=frame[AnimFrame::ZOOMY]/100.0
sprite.color.set(
frame[AnimFrame::COLORRED],
frame[AnimFrame::COLORGREEN],
frame[AnimFrame::COLORBLUE],
frame[AnimFrame::COLORALPHA]
)
sprite.tone.set(
frame[AnimFrame::TONERED],
frame[AnimFrame::TONEGREEN],
frame[AnimFrame::TONEBLUE],
frame[AnimFrame::TONEGRAY]
)
sprite.ox=sprite.src_rect.width/2
sprite.oy=sprite.src_rect.height/2
sprite.x=frame[AnimFrame::X]
sprite.y=frame[AnimFrame::Y]
if sprite!=user && sprite!=target
case frame[AnimFrame::PRIORITY]
when 0 sprite.z=5
when 1 sprite.z=35
when 2 if frame[AnimFrame::FOCUS]==1 sprite.z=(target) ? target.z-1 : 5
elsif frame[AnimFrame::FOCUS]==2 sprite.z=(user) ? user.z-1 : 5
else sprite.z=5
end
when 3 if frame[AnimFrame::FOCUS]==1 sprite.z=(target) ? target.z+1 : 35
elsif frame[AnimFrame::FOCUS]==2 sprite.z=(user) ? user.z+1 : 35
else sprite.z=35
end
else
sprite.z=35
end
end
end
|
#pbSpriteSetCenter(sprite, cx, cy) ⇒ Object
393
394
395
396
397
398
399
400
401
402
403
404
|
# File 'scripts/Pokemon_Sprites.rb', line 393
def pbSpriteSetCenter(sprite,cx,cy)
return if !sprite
if !sprite.bitmap
sprite.x=cx
sprite.y=cy
return
end
realwidth=sprite.bitmap.width*sprite.zoom_x
realheight=sprite.bitmap.height*sprite.zoom_y
sprite.x=cx-(realwidth/2)
sprite.y=cy-(realheight/2)
end
|
#pbSrcOver(dstColor, srcColor) ⇒ Object
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
|
# File 'scripts/SpriteWindow.rb', line 1348
def pbSrcOver(dstColor,srcColor)
er=srcColor.red*srcColor.alpha/255
eg=srcColor.green*srcColor.alpha/255
eb=srcColor.blue*srcColor.alpha/255
iea=255-srcColor.alpha
cr=dstColor.red*dstColor.alpha/255
cg=dstColor.green*dstColor.alpha/255
cb=dstColor.blue*dstColor.alpha/255
ica=255-dstColor.alpha
a=255-(iea*ica)/255
r=(iea*cr)/255+er
g=(iea*cg)/255+eg
b=(iea*cb)/255+eb
r=(a==0) ? 0 : r*255/a
g=(a==0) ? 0 : g*255/a
b=(a==0) ? 0 : b*255/a
return Color.new(r,g,b,a)
end
|
#pbStartsWith(s, pfx) ⇒ Object
3340
3341
3342
|
# File 'scripts/Compiler.rb', line 3340
def pbStartsWith(s,pfx)
return s[0,pfx.length]==pfx
end
|
#pbStartTrade(pokemonIndex, newpoke, nickname, trainerName, trainerGender = 0) ⇒ Object
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'scripts/PScreen_Trading.rb', line 183
def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
myPokemon=$Trainer.party[pokemonIndex]
opponent=PokeBattle_Trainer.new(trainerName,trainerGender)
opponent.setForeignID($Trainer)
yourPokemon=nil; resetmoves=true
if newpoke.is_a?(PokeBattle_Pokemon)
newpoke.trainerID=opponent.id
newpoke.ot=opponent.name
newpoke.otgender=opponent.gender
newpoke.language=opponent.language
yourPokemon=newpoke
resetmoves=false
else
if newpoke.is_a?(String) || newpoke.is_a?(Symbol)
raise _INTL("La especie no existe ({1}).",newpoke) if !hasConst?(PBSpecies,newpoke)
newpoke=getID(PBSpecies,newpoke)
end
yourPokemon=PokeBattle_Pokemon.new(newpoke,myPokemon.level,opponent)
end
yourPokemon.name=nickname
yourPokemon.obtainMode=2 yourPokemon.resetMoves if resetmoves
yourPokemon.pbRecordFirstMoves
$Trainer.seen[yourPokemon.species]=true
$Trainer.owned[yourPokemon.species]=true
pbSeenForm(yourPokemon)
pbFadeOutInWithMusic(99999){
evo=PokemonTradeScene.new
evo.pbStartScreen(myPokemon,yourPokemon,$Trainer.name,opponent.name)
evo.pbTrade
evo.pbEndScreen
}
$Trainer.party[pokemonIndex]=yourPokemon
end
|
#pbStorageCreator ⇒ Object
169
170
171
|
# File 'scripts/Settings.rb', line 169
def pbStorageCreator
return _INTL("Bill")
end
|
#pbStoreMail(pkmn, item, message, poke1 = nil, poke2 = nil, poke3 = nil) ⇒ Object
26
27
28
29
|
# File 'scripts/PItem_Mail.rb', line 26
def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil)
raise _INTL("El Pokémon ya tiene una carta") if pkmn.mail
pkmn.mail=PokemonMail.new(item,message,$Trainer.name,poke1,poke2,poke3)
end
|
#pbStrictLittleCupRules(double) ⇒ Object
#pbStringToAudioFile(str) ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'scripts/AudioPlay.rb', line 1
def pbStringToAudioFile(str)
if str[/^(.*)\:\s*(\d+)\s*\:\s*(\d+)\s*$/]
file=$1
volume=$2.to_i
pitch=$3.to_i
return RPG::AudioFile.new(file,volume,pitch)
elsif str[/^(.*)\:\s*(\d+)\s*$/]
file=$1
volume=$2.to_i
return RPG::AudioFile.new(file,volume,100)
else
return RPG::AudioFile.new(str,100,100)
end
end
|
#pbSweetScent ⇒ Object
Dulce Aroma / Sweet Scent
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
|
# File 'scripts/PField_HiddenMoves.rb', line 1078
def pbSweetScent
if $game_screen.weather_type!=PBFieldWeather::None
Kernel.pbMessage(_INTL("El dulce aroma se desvaneció por alguna razón..."))
return
end
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
count=0
viewport.color.alpha-=10
begin
if viewport.color.alpha<128 && count==0
viewport.color.red=255
viewport.color.green=0
viewport.color.blue=0
viewport.color.alpha+=8
else
count+=1
if count>10
viewport.color.alpha-=8
end
end
Graphics.update
Input.update
pbUpdateSceneMap
end until viewport.color.alpha<=0
viewport.dispose
encounter=nil
enctype=nil
enctype=$PokemonEncounters.pbEncounterType
if enctype<0 || !$PokemonEncounters.isEncounterPossibleHere?() ||
!pbEncounter(enctype)
Kernel.pbMessage(_INTL("Parece que no hay nada aquí..."))
end
end
|
#pbTestPass(follower, x, y, direction = nil) ⇒ Object
59
60
61
|
# File 'scripts/PField_DependentEvents.rb', line 59
def pbTestPass(follower,x,y,direction=nil)
return $MapFactory.isPassableStrict?(follower.map.map_id,x,y,follower)
end
|
#pbTextBitmap(text, maxwidth = Graphics.width) ⇒ Object
489
490
491
492
493
494
495
|
# File 'scripts/EventScene.rb', line 489
def pbTextBitmap(text,maxwidth=Graphics.width)
dims=[]
tmp=Bitmap.new(maxwidth,Graphics.height)
pbSetSystemFont(tmp)
drawFormattedTextEx(tmp,0,0,maxwidth,text,Color.new(248,248,248),Color.new(168,184,184))
return tmp
end
|
#pbTilePuzzle(game, board, width = 0, height = 0) ⇒ Object
550
551
552
553
554
555
556
557
558
|
# File 'scripts/PMinigame_TilePuzzles.rb', line 550
def pbTilePuzzle(game,board,width=0,height=0)
ret=false
scene=TilePuzzleScene.new(game,board,width,height)
screen=TilePuzzle.new(scene)
pbFadeOutIn(99999) {
ret=screen.pbStartScreen
}
return ret
end
|
#pbTimingList(canvas) ⇒ Object
Pop-up menus for buttons in right hand menu
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
|
# File 'scripts/BattleAnimationEditor.rb', line 2137
def pbTimingList(canvas)
commands=[]
cmdNewSound=-1
cmdNewBG=-1
cmdEditBG=-1
cmdNewFO=-1
cmdEditFO=-1
for i in canvas.animation.timing
commands.push(sprintf("%s",i))
end
commands[cmdNewSound=commands.length]=_INTL("Add: Play Sound...")
commands[cmdNewBG=commands.length]=_INTL("Add: Set Background Graphic...")
commands[cmdEditBG=commands.length]=_INTL("Add: Edit Background Color/Location...")
commands[cmdNewFO=commands.length]=_INTL("Add: Set Foreground Graphic...")
commands[cmdEditFO=commands.length]=_INTL("Add: Edit Foreground Color/Location...")
cmdwin=pbListWindow(commands,480)
cmdwin.x=0
cmdwin.y=0
cmdwin.width=640
cmdwin.height=384
cmdwin.opacity=200
cmdwin.viewport=canvas.viewport
framewindow=ControlWindow.new(0,384,640,32*4)
framewindow.addSlider(_INTL("Frame:"),1,canvas.animation.length,canvas.currentframe+1)
framewindow.addButton(_INTL("Set Frame"))
framewindow.addButton(_INTL("Delete Timing"))
framewindow.opacity=200
framewindow.viewport=canvas.viewport
loop do
Graphics.update
Input.update
cmdwin.update
framewindow.update
if cmdwin.index!=cmdNewSound &&
cmdwin.index!=cmdNewBG &&
cmdwin.index!=cmdEditBG &&
cmdwin.index!=cmdNewFO &&
cmdwin.index!=cmdEditFO
if framewindow.changed?(1) canvas.animation.timing[cmdwin.index].frame=framewindow.value(0)-1
cmdwin.commands[cmdwin.index]=sprintf("%s",canvas.animation.timing[cmdwin.index])
cmdwin.refresh
next
end
if framewindow.changed?(2) canvas.animation.timing.delete_at(cmdwin.index)
cmdwin.commands.delete_at(cmdwin.index)
cmdNewSound-=1 if cmdNewSound>=0
cmdNewBG-=1 if cmdNewBG>=0
cmdEditBG-=1 if cmdEditBG>=0
cmdNewFO-=1 if cmdNewFO>=0
cmdEditFO-=1 if cmdEditFO>=0
cmdwin.refresh
next
end
end
if (Input.trigger?(Input::C) || (cmdwin.doubleclick? rescue false))
redrawcmds=false
if cmdwin.index==cmdNewSound newaudio=PBAnimTiming.new(0)
if pbSelectSE(canvas,newaudio)
newaudio.frame=framewindow.value(0)-1
canvas.animation.timing.push(newaudio)
redrawcmds=true
end
elsif cmdwin.index==cmdNewBG newtiming=PBAnimTiming.new(1)
if pbSelectBG(canvas,newtiming)
newtiming.frame=framewindow.value(0)-1
canvas.animation.timing.push(newtiming)
redrawcmds=true
end
elsif cmdwin.index==cmdEditBG newtiming=PBAnimTiming.new(2)
if pbEditBG(canvas,newtiming)
newtiming.frame=framewindow.value(0)-1
canvas.animation.timing.push(newtiming)
redrawcmds=true
end
elsif cmdwin.index==cmdNewFO newtiming=PBAnimTiming.new(3)
if pbSelectBG(canvas,newtiming)
newtiming.frame=framewindow.value(0)-1
canvas.animation.timing.push(newtiming)
redrawcmds=true
end
elsif cmdwin.index==cmdEditFO newtiming=PBAnimTiming.new(4)
if pbEditBG(canvas,newtiming)
newtiming.frame=framewindow.value(0)-1
canvas.animation.timing.push(newtiming)
redrawcmds=true
end
else
case canvas.animation.timing[cmdwin.index].timingType
when 0
pbSelectSE(canvas,canvas.animation.timing[cmdwin.index])
when 1, 3
pbSelectBG(canvas,canvas.animation.timing[cmdwin.index])
when 2, 4
pbEditBG(canvas,canvas.animation.timing[cmdwin.index])
end
cmdwin.commands[cmdwin.index]=sprintf("%s",canvas.animation.timing[cmdwin.index])
cmdwin.refresh
end
if redrawcmds
cmdwin.commands[cmdNewSound]=nil if cmdNewSound>=0
cmdwin.commands[cmdNewBG]=nil if cmdNewBG>=0
cmdwin.commands[cmdEditBG]=nil if cmdEditBG>=0
cmdwin.commands[cmdNewFO]=nil if cmdNewFO>=0
cmdwin.commands[cmdEditFO]=nil if cmdEditFO>=0
cmdwin.commands.compact!
cmdwin.commands.push(sprintf("%s",canvas.animation.timing[canvas.animation.timing.length-1]))
cmdwin.commands[cmdNewSound=cmdwin.commands.length]=_INTL("Add: Play Sound...")
cmdwin.commands[cmdNewBG=cmdwin.commands.length]=_INTL("Add: Set Background Graphic...")
cmdwin.commands[cmdEditBG=cmdwin.commands.length]=_INTL("Add: Edit Background Color/Location...")
cmdwin.commands[cmdNewFO=cmdwin.commands.length]=_INTL("Add: Set Foreground Graphic...")
cmdwin.commands[cmdEditFO=cmdwin.commands.length]=_INTL("Add: Edit Foreground Color/Location...")
cmdwin.refresh
end
elsif Input.trigger?(Input::B)
break
end
end
cmdwin.dispose
framewindow.dispose
return
end
|
#pbTMRS ⇒ Object
Compilación de las compatibilidades de MT/MO/Tutor de Movimientos
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
|
# File 'scripts/Compiler.rb', line 2008
def pbTMRS rstm=[ :FOCUSPUNCH,:DRAGONCLAW,:WATERPULSE,:CALMMIND,:ROAR,
:TOXIC,:HAIL,:BULKUP,:BULLETSEED,:HIDDENPOWER,
:SUNNYDAY,:TAUNT,:ICEBEAM,:BLIZZARD,:HYPERBEAM,
:LIGHTSCREEN,:PROTECT,:RAINDANCE,:GIGADRAIN,:SAFEGUARD,
:FRUSTRATION,:SOLARBEAM,:IRONTAIL,:THUNDERBOLT,:THUNDER,
:EARTHQUAKE,:RETURN,:DIG,:PSYCHIC,:SHADOWBALL,
:BRICKBREAK,:DOUBLETEAM,:REFLECT,:SHOCKWAVE,:FLAMETHROWER,
:SLUDGEBOMB,:SANDSTORM,:FIREBLAST,:ROCKTOMB,:AERIALACE,
:TORMENT,:FACADE,:SECRETPOWER,:REST,:ATTRACT,
:THIEF,:STEELWING,:SKILLSWAP,:SNATCH,:OVERHEAT,
:CUT,:FLY,:SURF,:STRENGTH,:FLASH,:ROCKSMASH,:WATERFALL,:DIVE]
ret=[]
for i in 0...rstm.length
ret.push((parseMove(rstm.to_s) rescue 0))
end
return ret
end
|
#pbToneChangeAll(tone, duration) ⇒ Object
2487
2488
2489
2490
2491
2492
|
# File 'scripts/PField_Field.rb', line 2487
def pbToneChangeAll(tone, duration)
$game_screen.start_tone_change(tone,duration * 2)
for picture in $game_screen.pictures
picture.start_tone_change(tone,duration * 2) if picture
end
end
|
#pbTooHeavy?(pokemon, maxWeightInKg) ⇒ Boolean
28
29
30
31
32
33
34
35
36
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 28
def pbTooHeavy?(pokemon,maxWeightInKg)
dexdata=pbOpenDexData()
pbDexDataOffset(dexdata,pokemon.is_a?(Numeric) ? pokemon : pokemon.species,33)
height=dexdata.fgetw
weight=dexdata.fgetw
maxWeightInKg=(maxWeightInKg*10).round
dexdata.close()
return weight>maxWeightInKg
end
|
#pbTooTall?(pokemon, maxHeightInMeters) ⇒ Boolean
18
19
20
21
22
23
24
25
26
|
# File 'scripts/PBattle_OrgBattleRules.rb', line 18
def pbTooTall?(pokemon,maxHeightInMeters)
dexdata=pbOpenDexData()
pbDexDataOffset(dexdata,pokemon.is_a?(Numeric) ? pokemon : pokemon.species,33)
height=dexdata.fgetw
weight=dexdata.fgetw
maxHeightInMeters=(maxHeightInMeters*10).round
dexdata.close()
return height>maxHeightInMeters
end
|
#pbTopRightWindow(text) ⇒ Object
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'scripts/PItem_Items.rb', line 115
def pbTopRightWindow(text)
window=Window_AdvancedTextPokemon.new(text)
window.z=99999
window.width=198
window.y=0
window.x=Graphics.width-window.width
pbPlayDecisionSE()
loop do
Graphics.update
Input.update
window.update
if Input.trigger?(Input::C)
break
end
end
window.dispose
end
|
#pbTradeCheckEvolution(pokemon, pokemon2) ⇒ Object
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'scripts/PScreen_Trading.rb', line 221
def pbTradeCheckEvolution(pokemon,pokemon2)
ret=pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
case evonib
when PBEvolution::Trade
next poke
when PBEvolution::TradeItem
if pokemon.item==level
pokemon.setItem(0)
next poke
end
when PBEvolution::TradeSpecies
next poke if pokemon2.species==level
end
next -1
}
return ret
end
|
#pbTrainerBattle(trainerid, trainername, endspeech, doublebattle = false, trainerparty = 0, canlose = false, variable = nil) ⇒ Object
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 224
def pbTrainerBattle(trainerid,trainername,endspeech,
doublebattle=false,trainerparty=0,canlose=false,variable=nil)
if $Trainer.pokemonCount==0
Kernel.pbMessage(_INTL("SALTANDO COMBATES...")) if $DEBUG
return false
end
if !$PokemonTemp.waitingTrainer && $Trainer.ablePokemonCount>1 &&
pbMapInterpreterRunning?
thisEvent=pbMapInterpreter.get_character(0)
triggeredEvents=$game_player.pbTriggeredTrainerEvents([2],false)
otherEvent=[]
for i in triggeredEvents
if i.id!=thisEvent.id && !$game_self_switches[[$game_map.map_id,i.id,"A"]]
otherEvent.push(i)
end
end
if otherEvent.length==1
trainer=pbLoadTrainer(trainerid,trainername,trainerparty)
Events.onTrainerPartyLoad.trigger(nil,trainer)
if !trainer
pbMissingTrainer(trainerid,trainername,trainerparty)
return false
end
if trainer[2].length<=6 $PokemonTemp.waitingTrainer=[trainer,thisEvent.id,endspeech]
return false
end
end
end
trainer=pbLoadTrainer(trainerid,trainername,trainerparty)
Events.onTrainerPartyLoad.trigger(nil,trainer)
if !trainer
pbMissingTrainer(trainerid,trainername,trainerparty)
return false
end
if $PokemonGlobal.partner && ($PokemonTemp.waitingTrainer || doublebattle)
othertrainer=PokeBattle_Trainer.new(
$PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
othertrainer.id=$PokemonGlobal.partner[2]
othertrainer.party=$PokemonGlobal.partner[3]
playerparty=[]
for i in 0...$Trainer.party.length
playerparty[i]=$Trainer.party[i]
end
for i in 0...othertrainer.party.length
playerparty[6+i]=othertrainer.party[i]
end
fullparty1=true
playertrainer=[$Trainer,othertrainer]
doublebattle=true
else
playerparty=$Trainer.party
playertrainer=$Trainer
fullparty1=false
end
if $PokemonTemp.waitingTrainer
combinedParty=[]
fullparty2=false
if false
if $PokemonTemp.waitingTrainer[0][2].length>3
raise _INTL("El equipo del Rival 1 tiene más de tres Pokémon, lo que no está permitido")
end
if trainer[2].length>3
raise _INTL("El equipo del Rival 2 tiene más de tres Pokémon, lo que no está permitido")
end
elsif $PokemonTemp.waitingTrainer[0][2].length>3 || trainer[2].length>3
for i in 0...$PokemonTemp.waitingTrainer[0][2].length
combinedParty[i]=$PokemonTemp.waitingTrainer[0][2][i]
end
for i in 0...trainer[2].length
combinedParty[6+i]=trainer[2][i]
end
fullparty2=true
else
for i in 0...$PokemonTemp.waitingTrainer[0][2].length
combinedParty[i]=$PokemonTemp.waitingTrainer[0][2][i]
end
for i in 0...trainer[2].length
combinedParty[3+i]=trainer[2][i]
end
fullparty2=false
end
scene=pbNewBattleScene
battle=PokeBattle_Battle.new(scene,playerparty,combinedParty,playertrainer,
[$PokemonTemp.waitingTrainer[0][0],trainer[0]])
trainerbgm=pbGetTrainerBattleBGM(
[$PokemonTemp.waitingTrainer[0][0],trainer[0]])
battle.fullparty1=fullparty1
battle.fullparty2=fullparty2
battle.doublebattle=battle.pbDoubleBattleAllowed?()
battle.endspeech=$PokemonTemp.waitingTrainer[2]
battle.endspeech2=endspeech
battle.items=[$PokemonTemp.waitingTrainer[0][1],trainer[1]]
else
scene=pbNewBattleScene
battle=PokeBattle_Battle.new(scene,playerparty,trainer[2],playertrainer,trainer[0])
battle.fullparty1=fullparty1
battle.doublebattle=doublebattle ? battle.pbDoubleBattleAllowed?() : false
battle.endspeech=endspeech
battle.items=trainer[1]
trainerbgm=pbGetTrainerBattleBGM(trainer[0])
end
if Input.press?(Input::CTRL) && $DEBUG
Kernel.pbMessage(_INTL("SALTANDO COMBATES..."))
Kernel.pbMessage(_INTL("TRAS PERDER..."))
Kernel.pbMessage(battle.endspeech)
Kernel.pbMessage(battle.endspeech2) if battle.endspeech2
if $PokemonTemp.waitingTrainer
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1],"A",true)
$PokemonTemp.waitingTrainer=nil
end
return true
end
Events.onStartBattle.trigger(nil,nil)
battle.internalbattle=true
pbPrepareBattle(battle)
restorebgm=true
decision=0
Audio.me_stop
pbBattleAnimation(trainerbgm,trainer[0].trainertype,trainer[0].name) {
pbSceneStandby {
decision=battle.pbStartBattle(canlose)
}
for i in $Trainer.party; (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); end
if $PokemonGlobal.partner
pbHealAll
for i in $PokemonGlobal.partner[3]
i.heal
i.makeUnmega rescue nil
i.makeUnprimal rescue nil
end
end
if decision==2 || decision==5
if canlose
for i in $Trainer.party; i.heal; end
for i in 0...10
Graphics.update
end
end
end
Events.onEndBattle.trigger(nil,decision,canlose)
if decision==1
if $PokemonTemp.waitingTrainer
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1],"A",true)
end
end
}
Input.update
pbSet(variable,decision)
$PokemonTemp.waitingTrainer=nil
return (decision==1)
end
|
#pbTrainerBattleEditor ⇒ Object
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
|
# File 'scripts/Editor.rb', line 2679
def pbTrainerBattleEditor
selection=0
trainers=load_data("Data/trainers.dat")
trainertypes=load_data("Data/trainertypes.dat")
modified=false
for trainer in trainers
trtype=trainer[0]
if !trainertypes || !trainertypes[trtype]
trainer[0]=0
modified=true
end
end
if modified
save_data(trainers,"Data/trainers.dat")
pbConvertTrainerData
end
pbListScreenBlock(_INTL("Combate Entrenador"),TrainerBattleLister.new(selection,true)){|button,trtype|
if trtype
index=trtype[0]
trainerdata=trtype[1]
if button==Input::A
if index>=0
if Kernel.pbConfirmMessageSerious("¿Borrar este combate de entrenador?")
data=load_data("Data/trainers.dat")
data.delete_at(index)
save_data(data,"Data/trainers.dat")
pbConvertTrainerData
Kernel.pbMessage(_INTL("El combate de entrenador fue borrado."))
end
end
elsif button==Input::C
selection=index
if selection<0
ret=Kernel.pbMessage(_INTL("Primero. Establece el tipo de entrenador."),[
_INTL("Usar tipo existente"),_INTL("Usar tipo nuevo"),_INTL("Salir")
],3)
trainertype=-1
trainername=""
if ret==0
trainertype=pbListScreen(_INTL("Tipo Entrenador"),TrainerTypeLister.new(0,false))
next if !trainertype
trainertype=trainertype[0]
next if trainertype<0
elsif ret==1
trainertype=pbTrainerTypeEditorNew(nil)
next if trainertype<0
else
next
end
trainername=Kernel.pbMessageFreeText(_INTL("Ahora, ingresa el nombre del entrenador."),"",false,32)
next if trainername==""
trainerparty=pbGetFreeTrainerParty(trainertype,trainername)
if trainerparty<0
Kernel.pbMessage(_INTL("No hay espacio para crear un entrenador de ese tipo y nombre."))
next
end
pbNewTrainer(trainertype,trainername,trainerparty)
else
data=[
trainerdata[0], trainerdata[1], trainerdata[4], trainerdata[3][0], trainerdata[3][1], trainerdata[3][2], trainerdata[3][3], trainerdata[3][4], trainerdata[3][5], trainerdata[2][0], trainerdata[2][1], trainerdata[2][2], trainerdata[2][3], trainerdata[2][4], trainerdata[2][5], trainerdata[2][6], trainerdata[2][7] ]
save=false
while true
data=TrainerBattleProperty.set(trainerdata[1],data)
if data
trainerdata=[
data[0],
data[1],
[data[9],data[10],data[11],data[12],data[13],data[14],data[15],data[16]].find_all {|i| i && i!=0 }, [data[3],data[4],data[5],data[6],data[7],data[8]].find_all {|i| i && i[TPSPECIES]!=0 }, data[2]
]
if trainerdata[3].length==0
Kernel.pbMessage(_INTL("No se puedo guardar. La lista de Pokémon está vacía."))
elsif !trainerdata[1] || trainerdata[1].length==0
Kernel.pbMessage(_INTL("No se puedo guardar. Falta ingresar nombre."))
else
save=true
break
end
else
break
end
end
if save
data=load_data("Data/trainers.dat")
data[index]=trainerdata
save_data(data,"Data/trainers.dat")
pbConvertTrainerData
end
end
end
end
}
end
|
#pbTrainerCheck(trainerid, trainername, maxbattles, startBattleId = 0) ⇒ Object
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 176
def pbTrainerCheck(trainerid,trainername,maxbattles,startBattleId=0)
if $DEBUG
if trainerid.is_a?(String) || trainerid.is_a?(Symbol)
pbTrainerTypeCheck(trainerid)
return false if !hasConst?(PBTrainers,trainerid)
trainerid=PBTrainers.const_get(trainerid)
end
for i in 0...maxbattles
trainer=pbLoadTrainer(trainerid,trainername,i+startBattleId)
if !trainer
traineridstring="#{trainerid}"
traineridstring=getConstantName(PBTrainers,trainerid) rescue "-"
if Kernel.pbConfirmMessage(_INTL("¿Agregar combate nuevo {1} (de {2}) para ({3}, {4})?",
i+1,maxbattles,traineridstring,trainername))
pbNewTrainer(trainerid,trainername,i)
end
end
end
end
return true
end
|
#pbTrainerInfo(pokemonlist, trfile, rules) {|nil| ... } ⇒ Object
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1054
def pbTrainerInfo(pokemonlist,trfile,rules)
bttrainers=pbGetBTTrainers(trfile)
btpokemon=pbGetBTPokemon(trfile)
trainertypes=load_data("Data/trainertypes.dat")
if bttrainers.length==0
for i in 0...200
yield(nil) if block_given? && i%50==0
trainerid=0
money=30
loop do
trainerid=rand(PBTrainers.maxValue)+1
trainerid=getID(PBTrainers,:YOUNGSTER) if rand(30)==0
next if PBTrainers.getName(trainerid)==""
money=(!trainertypes[trainerid] ||
!trainertypes[trainerid][3]) ? 30 : trainertypes[trainerid][3]
next if money>=100
break
end
gender=(!trainertypes[trainerid] ||
!trainertypes[trainerid][7]) ? 2 : trainertypes[trainerid][7]
randomName=getRandomNameEx(gender,nil,0,12)
tr=[trainerid,randomName,_INTL("¡Aquí vengo!"),
_INTL("¡Si! ¡Yo gané!"),_INTL("¡Hombre! ¡He perdido!"),[]]
bttrainers.push(tr)
end
bttrainers.sort!{|a,b|
money1=(!trainertypes[a[0]] ||
!trainertypes[a[0]][3]) ? 30 : trainertypes[a[0]][3]
money2=(!trainertypes[b[0]] ||
!trainertypes[b[0]][3]) ? 30 : trainertypes[b[0]][3]
money1==money2 ? a[0]<=>b[0] : money1<=>money2
}
end
yield(nil) if block_given?
suggestedLevel=rules.ruleset.suggestedLevel
rulesetTeam=rules.ruleset.copy.clearPokemonRules
pkmntypes=[]
validities=[]
t=Time.new
for pkmn in pokemonlist
pkmn.level=suggestedLevel if pkmn.level!=suggestedLevel
pkmntypes.push(getTypes(pkmn.species))
validities.push(rules.ruleset.isPokemonValid?(pkmn))
end
newbttrainers=[]
for btt in 0...bttrainers.length
yield(nil) if block_given? && btt%50==0
trainerdata=bttrainers[btt]
pokemonnumbers=trainerdata[5] || []
species=[]
types=[]
(PBTypes.maxValue+1).times {|typ| types[typ]=0 }
for pn in pokemonnumbers
pkmn=btpokemon[pn]
species.push(pkmn.species)
t=getTypes(pkmn.species)
t.each{|typ|
types[typ]+=1
}
end
species|=[] count=0
(PBTypes.maxValue+1).times {|typ|
if types[typ]>=5
types[typ]/=4
types[typ]=10 if types[typ]>10
else
types[typ]=0
end
count+=types[typ]
}
types[0]=1 if count==0
if pokemonnumbers.length==0
(PBTypes.maxValue+1).times {|typ|
types[typ]=1
}
end
numbers=[]
if pokemonlist
numbersPokemon=[]
for index in 0...pokemonlist.length
pkmn=pokemonlist[index]
next if !validities[index]
absDiff=((index*8/pokemonlist.length)-(btt*8/bttrainers.length)).abs
sameDiff=(absDiff==0)
if species.include?(pkmn.species)
weight=[32,12,5,2,1,0,0,0][[absDiff,7].min]
if rand(40)<weight
numbers.push(index)
numbersPokemon.push(pokemonlist[index])
end
else
t=pkmntypes[index]
t.each{|typ|
weight=[32,12,5,2,1,0,0,0][[absDiff,7].min]
weight*=types[typ]
if rand(40)<weight
numbers.push(index)
numbersPokemon.push(pokemonlist[index])
end
}
end
end
numbers|=[]
if (numbers.length<6 ||
!rulesetTeam.hasValidTeam?(numbersPokemon))
for index in 0...pokemonlist.length
pkmn=pokemonlist[index]
next if !validities[index]
if species.include?(pkmn.species)
numbers.push(index)
numbersPokemon.push(pokemonlist[index])
else
t=pkmntypes[index]
t.each{|typ|
if types[typ]>0 && !numbers.include?(index)
numbers.push(index)
numbersPokemon.push(pokemonlist[index])
break
end
}
end
break if numbers.length>=6 && rules.ruleset.hasValidTeam?(numbersPokemon)
end
if numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon)
while numbers.length<pokemonlist.length &&
(numbers.length<6 || !rules.ruleset.hasValidTeam?(numbersPokemon))
index=rand(pokemonlist.length)
if !numbers.include?(index)
numbers.push(index)
numbersPokemon.push(pokemonlist[index])
end
end
end
end
numbers.sort!
end
newbttrainers.push([trainerdata[0],trainerdata[1],trainerdata[2],
trainerdata[3],trainerdata[4],numbers])
end
yield(nil) if block_given?
pbpokemonlist=[]
for pkmn in pokemonlist
pbpokemonlist.push(PBPokemon.fromPokemon(pkmn))
end
trlists=(load_data("Data/trainerlists.dat") rescue [])
hasDefault=false
trIndex=-1
for i in 0...trlists.length
hasDefault=true if trlists[i][5]
end
for i in 0...trlists.length
if trlists[i][2].include?(trfile)
trIndex=i
trlists[i][0]=newbttrainers
trlists[i][1]=pbpokemonlist
trlists[i][5]=!hasDefault
end
end
yield(nil) if block_given?
if trIndex<0
info=[newbttrainers,pbpokemonlist,[trfile],
trfile+"tr.txt",trfile+"pm.txt",!hasDefault]
trlists.push(info)
end
yield(nil) if block_given?
save_data(trlists,"Data/trainerlists.dat")
yield(nil) if block_given?
pbSaveTrainerLists()
yield(nil) if block_given?
end
|
#pbTrainerMapName(phonenum) ⇒ Object
293
294
295
296
|
# File 'scripts/PScreen_Phone.rb', line 293
def pbTrainerMapName(phonenum)
return "" if !phonenum[6] || phonenum[6]==0
return pbGetMessage(MessageTypes::MapNames,phonenum[6])
end
|
#pbTrainerPC ⇒ Object
3041
3042
3043
3044
3045
|
# File 'scripts/PScreen_Storage.rb', line 3041
def pbTrainerPC
Kernel.pbMessage(_INTL("\\se[computeropen]{1} encendió la PC.",$Trainer.name))
pbSEPlay("computerclose")
end
|
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
|
# File 'scripts/PScreen_Storage.rb', line 2984
def
loop do
command=Kernel.pbMessage(_INTL("¿Qué quieres hacer?"),[
_INTL("Almacén Objetos"),
_INTL("Buzón"),
_INTL("Desconexión")
],-1)
if command==0
pbPCItemStorage
elsif command==1
pbPCMailbox
else
break
end
end
end
|
#pbTrainerSpecies(phonenum) ⇒ Object
298
299
300
301
302
303
304
305
306
307
308
|
# File 'scripts/PScreen_Phone.rb', line 298
def pbTrainerSpecies(phonenum)
return "" if !phonenum[0]
partyid=[0,(phonenum[5]-1)].max
trainer=pbLoadTrainerData(phonenum[1],phonenum[2],partyid)
if !trainer || trainer[3].length==0
return ""
else
rndpoke=trainer[3][rand(trainer[3].length)]
return PBSpecies.getName(rndpoke[0])
end
end
|
#pbTrainerTypeCheck(symbol) ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'scripts/PTrainer_NPCTrainers.rb', line 148
def pbTrainerTypeCheck(symbol)
ret=true
if $DEBUG
if !hasConst?(PBTrainers,symbol)
ret=false
else
trtype=PBTrainers.const_get(symbol)
data=load_data("Data/trainertypes.dat")
ret=false if !data || !data[trtype]
end
if !ret
if Kernel.pbConfirmMessage(_INTL("¿Agregar tipo de entrenador nuevo {1}?",symbol))
pbTrainerTypeEditorNew(symbol.to_s)
end
pbMapInterpreter.command_end if pbMapInterpreter
end
end
return ret
end
|
#pbTrainerTypeEditor ⇒ Object
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
|
# File 'scripts/Editor.rb', line 2477
def pbTrainerTypeEditor
selection=0
trainerTypes=[
[_INTL("Nombre Interno"),ReadOnlyProperty,
_INTL("Nombre interno que aparece en constructores como PBTrainers::XXX.")],
[_INTL("Nombre del Entrenador"),StringProperty,
_INTL("Nombre del tipo de entrenador usado en los textos del juego.")],
[_INTL("Dinero por Nivel"),LimitProperty.new(255),
_INTL("El jugador gana esta cantidad de dinero multiplicada por el nivel del Pokémon de mayor nivel del entrenador.")],
[_INTL("MFN Batalla"),BGMProperty,
_INTL("Música de Fondo tocada durante la batalla contra este tipo de entrenadores.")],
[_INTL("EM Final Batalla"),MEProperty,
_INTL("Efecto de Música tocado cuando el jugador gana la batalla con este tipo de entrenadores.")],
[_INTL("EM Inicio Batalla"),MEProperty,
_INTL("Efecto de Música tocado antes de pelear contra los entrenadores de este tipo.")],
[_INTL("Género"),EnumProperty.new([_INTL("Masculino"),_INTL("Femenino"),_INTL("Mixto")]),
_INTL("Género del tipo de entrenador.")],
[_INTL("Destreza"),LimitProperty.new(255),
_INTL("Nivel de destreza del tipo de entrenador.")],
[_INTL("Códigos de Habilidades"),StringProperty,
_INTL("Letras/frases que representan cambios en la IA de los entrenadores de este tipo.")],
]
pbListScreenBlock(_INTL("Tipos de Entrenadores"),TrainerTypeLister.new(selection,true)){|button,trtype|
if trtype
if button==Input::A
if trtype[0]>=0
if Kernel.pbConfirmMessageSerious("¿Borrar este tipo de entrenador?")
data=load_data("Data/trainertypes.dat")
removeConstantValue(PBTrainers,trtype[0])
data[trtype[0]]=nil
save_data(data,"Data/trainertypes.dat")
pbConvertTrainerData
Kernel.pbMessage(_INTL("El tipo de entrenador fue borrado."))
end
end
elsif button==Input::C
selection=trtype[0]
if selection<0
newid=pbTrainerTypeEditorNew(nil)
if newid>=0
selection=newid
end
else
data=[]
for i in 1..trtype.length
data.push(trtype[i])
end
save=pbPropertyList(trtype[2],data,trainerTypes,true)
if save
pbTrainerTypeEditorSave(selection,data)
end
end
end
end
}
end
|
#pbTrainerTypeEditorNew(trconst) ⇒ Object
Trainer type editor / Editor de tipo de entrenador
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
|
# File 'scripts/Editor.rb', line 2395
def pbTrainerTypeEditorNew(trconst)
data=load_data("Data/trainertypes.dat")
maxid=-1
for rec in data
next if !rec
maxid=[maxid,rec[0]].max
end
trainertype=maxid+1
trname=Kernel.pbMessageFreeText(_INTL("Por favor, ingrese el nombre del tipo de entrenador."),
trconst ? trconst.gsub(/_+/," ") : "",false,256)
if trname=="" && !trconst
return -1
else
if !trconst
trconst=trname.gsub(/[^A-Za-z0-9_]/,"")
trconst=trconst.sub(/^([a-z])/){ $1.upcase }
if trconst.length==0
trconst=sprintf("T_%03d",trainertype)
elsif !trconst[0,1][/[A-Z]/]
trconst="T_"+trconst
end
end
trname=trconst if trname==""
cname=trname.gsub(/é/,"e")
cname=cname.gsub(/[^A-Za-z0-9_]/,"")
cname=cname.upcase
if hasConst?(PBTrainers,cname)
suffix=1
100.times do
tname=sprintf("%s_%d",cname,suffix)
if !hasConst?(PBTrainers,tname)
cname=tname
break
end
suffix+=1
end
end
if hasConst?(PBTrainers,cname)
Kernel.pbMessage(_INTL("Error al crear el tipo de entrenador. Elige un nombre diferente."))
return -1
end
record=[]
record[0]=trainertype
record[1]=cname
record[2]=trname
record[7]=Kernel.pbMessage(_INTL("¿Es el género masculino, femenino o mixto?"),[
_INTL("Masculino"),_INTL("Femenino"),_INTL("Mixto")],0)
params=ChooseNumberParams.new
params.setRange(0,255)
params.setDefaultValue(30)
record[3]=Kernel.pbMessageChooseNumber(
_INTL("Indicar la cantidad de dinero por nivel que se obtiene venciendo a este Tipo de Entrenador."),params)
record[8]=record[3]
record[9]=""
PBTrainers.const_set(cname,record[0])
data[record[0]]=record
save_data(data,"Data/trainertypes.dat")
pbConvertTrainerData
Kernel.pbMessage(_INTL("Se ha creado el Tipo de Entrenador (ID: {1}).",record[0]))
Kernel.pbMessage(
_ISPRINTF("Ubica el gráfico del Entrenador (trainer{1:03d}.png o trainer{2:s}.png) en la carpeta Graphics/Characters, o estará en blanco.",
record[0],getConstantName(PBTrainers,record[0])))
return record[0]
end
end
|
#pbTrainerTypeEditorSave(trainertype, ttdata) ⇒ Object
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
|
# File 'scripts/Editor.rb', line 2464
def pbTrainerTypeEditorSave(trainertype,ttdata)
record=[]
record[0]=trainertype
for i in 0..ttdata.length
record.push(ttdata[i])
end
setConstantName(PBTrainers,trainertype,ttdata[0])
data=load_data("Data/trainertypes.dat")
data[record[0]]=record
data=save_data(data,"Data/trainertypes.dat")
pbConvertTrainerData
end
|
#pbTriadDuel(name, minLevel, maxLevel, rules = nil, oppdeck = nil, prize = nil) ⇒ Object
1301
1302
1303
1304
1305
1306
1307
1308
1309
|
# File 'scripts/PMinigame_TripleTriad.rb', line 1301
def pbTriadDuel(name,minLevel,maxLevel,rules=nil,oppdeck=nil,prize=nil)
ret=0
pbFadeOutInWithMusic(99999){
scene=TriadScene.new
screen=TriadScreen.new(scene)
ret=screen.pbStartScreen(name,minLevel,maxLevel,rules,oppdeck,prize)
}
return ret
end
|
#pbTriadList ⇒ Object
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
|
# File 'scripts/PMinigame_TripleTriad.rb', line 1252
def pbTriadList
commands=[]
for i in 0...$PokemonGlobal.triads.length
item=$PokemonGlobal.triads[i]
speciesname=PBSpecies.getName(item[0])
commands.push(_INTL("{1} x{2}",speciesname,item[1]))
end
commands.push(_INTL("CANCEL"))
if commands.length==1
Kernel.pbMessage(_INTL("You have no cards."))
return
end
cmdwindow=Window_CommandPokemonEx.newWithSize(commands,0,0,256,Graphics.height)
cmdwindow.z=99999
sprite=Sprite.new
sprite.z=99999
sprite.x=256+40
sprite.y=48
moneyString=_INTL("${1}",$Trainer.money)
done=false
lastIndex=-1
while !done
loop do
Graphics.update
Input.update
cmdwindow.update
if lastIndex!=cmdwindow.index
sprite.bitmap.dispose if sprite.bitmap
if cmdwindow.index<$PokemonGlobal.triads.length
sprite.bitmap=TriadCard.new($PokemonGlobal.triads.getItem(cmdwindow.index)).createBitmap(1)
end
lastIndex=cmdwindow.index
end
if Input.trigger?(Input::B)
done=true
break
end
if Input.trigger?(Input::C)
if cmdwindow.index>=$PokemonGlobal.triads.length
done=true
break
end
end
end
end
cmdwindow.dispose
sprite.dispose
end
|
#pbTryString(x) ⇒ Object
1383
1384
1385
1386
|
# File 'scripts/SpriteWindow.rb', line 1383
def pbTryString(x)
ret=pbGetFileChar(x)
return (ret!=nil && ret!="") ? x : nil
end
|
#pbTurnTowardEvent(event, otherEvent) ⇒ Object
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
|
# File 'scripts/PField_Field.rb', line 2320
def pbTurnTowardEvent(event,otherEvent)
sx=0
sy=0
if $MapFactory
relativePos=$MapFactory.getThisAndOtherEventRelativePos(otherEvent,event)
sx = relativePos[0]
sy = relativePos[1]
else
sx = event.x - otherEvent.x
sy = event.y - otherEvent.y
end
if sx == 0 and sy == 0
return
end
if sx.abs > sy.abs
sx > 0 ? event.turn_left : event.turn_right
else
sy > 0 ? event.turn_up : event.turn_down
end
end
|
#pbTweening(canvas) ⇒ Object
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
|
# File 'scripts/BattleAnimationEditor.rb', line 2524
def pbTweening(canvas)
sliderwin2=ControlWindow.new(0,0,320,32*10)
sliderwin2.viewport=canvas.viewport
sliderwin2.opacity=200
s1set0=sliderwin2.addSlider(_INTL("Starting Frame:"),1,canvas.animation.length,1)
s1set1=sliderwin2.addSlider(_INTL("Ending Frame:"),1,canvas.animation.length,canvas.animation.length)
s1set2=sliderwin2.addSlider(_INTL("First Cel:"),0,PBAnimation::MAXSPRITES-1,0)
s1set3=sliderwin2.addSlider(_INTL("Last Cel:"),0,PBAnimation::MAXSPRITES-1,PBAnimation::MAXSPRITES-1)
set0=sliderwin2.addCheckbox(_INTL("Pattern"))
set1=sliderwin2.addCheckbox(_INTL("Position/Zoom/Angle"))
set2=sliderwin2.addCheckbox(_INTL("Opacity/Blending"))
okbutton=sliderwin2.addButton(_INTL("Aceptar"))
cancelbutton=sliderwin2.addButton(_INTL("Salir"))
loop do
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(okbutton) || Input.trigger?(Input::C)
startframe=sliderwin2.value(s1set0)-1
endframe=sliderwin2.value(s1set1)-1
break if startframe>=endframe
frames=endframe-startframe
startcel=sliderwin2.value(s1set2)
endcel=sliderwin2.value(s1set3)
for j in startcel..endcel
cel1=canvas.animation[startframe][j]
cel2=canvas.animation[endframe][j]
next if !cel1||!cel2
diffPattern=cel2[AnimFrame::PATTERN]-cel1[AnimFrame::PATTERN]
diffX=cel2[AnimFrame::X]-cel1[AnimFrame::X]
diffY=cel2[AnimFrame::Y]-cel1[AnimFrame::Y]
diffZoomX=cel2[AnimFrame::ZOOMX]-cel1[AnimFrame::ZOOMX]
diffZoomY=cel2[AnimFrame::ZOOMY]-cel1[AnimFrame::ZOOMY]
diffAngle=cel2[AnimFrame::ANGLE]-cel1[AnimFrame::ANGLE]
diffOpacity=cel2[AnimFrame::OPACITY]-cel1[AnimFrame::OPACITY]
diffBlend=cel2[AnimFrame::BLENDTYPE]-cel1[AnimFrame::BLENDTYPE]
startPattern=cel1[AnimFrame::PATTERN]
startX=cel1[AnimFrame::X]
startY=cel1[AnimFrame::Y]
startZoomX=cel1[AnimFrame::ZOOMX]
startZoomY=cel1[AnimFrame::ZOOMY]
startAngle=cel1[AnimFrame::ANGLE]
startOpacity=cel1[AnimFrame::OPACITY]
startBlend=cel1[AnimFrame::BLENDTYPE]
for k in 0..frames
cel=canvas.animation[startframe+k][j]
curcel=cel
if !cel
cel=pbCreateCel(0,0,0)
canvas.animation[startframe+k][j]=cel
end
if sliderwin2.value(set0) || !curcel
cel[AnimFrame::PATTERN]=startPattern+(diffPattern*k/frames)
end
if sliderwin2.value(set1) || !curcel
cel[AnimFrame::X]=startX+(diffX*k/frames)
cel[AnimFrame::Y]=startY+(diffY*k/frames)
cel[AnimFrame::ZOOMX]=startZoomX+(diffZoomX*k/frames)
cel[AnimFrame::ZOOMY]=startZoomY+(diffZoomY*k/frames)
cel[AnimFrame::ANGLE]=startAngle+(diffAngle*k/frames)
end
if sliderwin2.value(set2) || !curcel
cel[AnimFrame::OPACITY]=startOpacity+(diffOpacity*k/frames)
cel[AnimFrame::BLENDTYPE]=startBlend+(diffBlend*k/frames)
end
end
end
canvas.invalidate
break
end
if sliderwin2.changed?(cancelbutton) || Input.trigger?(Input::B)
break
end
end
sliderwin2.dispose
end
|
#pbUpdateDoor(event, mapdata) ⇒ Object
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
|
# File 'scripts/Compiler.rb', line 3272
def pbUpdateDoor(event,mapdata)
changed=false
return false if event.is_a?(RPG::CommonEvent)
if event.pages.length>=2 &&
event.pages[event.pages.length-1].condition.switch1_valid &&
event.pages[event.pages.length-1].condition.switch1_id==22 &&
event.pages[event.pages.length-1].list.length>5 &&
event.pages[event.pages.length-1].graphic.character_name!="" &&
mapdata.switchName(event.pages[event.pages.length-1].condition.switch1_id)!='s:tsOff?("A")' &&
event.pages[event.pages.length-1].list[0].code==111
event.pages[event.pages.length-1].condition.switch1_id=mapdata.registerSwitch('s:tsOff?("A")')
changed=true
end
if event.pages.length>=2 &&
event.pages[event.pages.length-1].condition.switch1_valid &&
event.pages[event.pages.length-1].list.length>5 &&
event.pages[event.pages.length-1].graphic.character_name!="" &&
mapdata.switchName(event.pages[event.pages.length-1].condition.switch1_id)=='s:tsOff?("A")' &&
event.pages[event.pages.length-1].list[0].code==111
list=event.pages[event.pages.length-2].list
transferCommand=list.find_all {|cmd| cmd.code==201 }
if transferCommand.length==1 && !list.any?{|cmd| cmd.code==208 }
list.clear
pbPushMoveRouteAndWait(list,0,[
PBMoveRoute::PlaySE,RPG::AudioFile.new("Entering Door"),PBMoveRoute::Wait,2,
PBMoveRoute::TurnLeft,PBMoveRoute::Wait,2,
PBMoveRoute::TurnRight,PBMoveRoute::Wait,2,
PBMoveRoute::TurnUp,PBMoveRoute::Wait,2])
pbPushMoveRouteAndWait(list,-1,[
PBMoveRoute::ThroughOn,PBMoveRoute::Up,PBMoveRoute::ThroughOff])
pbPushEvent(list,208,[0]) pbPushMoveRouteAndWait(list,0,[PBMoveRoute::Wait,2,
PBMoveRoute::TurnRight,PBMoveRoute::Wait,2,
PBMoveRoute::TurnLeft,PBMoveRoute::Wait,2,
PBMoveRoute::TurnDown,PBMoveRoute::Wait,2])
pbPushEvent(list,223,[Tone.new(-255,-255,-255),6])
pbPushWait(list,8)
pbPushEvent(list,208,[1])
pbPushEvent(list,transferCommand[0].code,transferCommand[0].parameters)
pbPushEvent(list,223,[Tone.new(0,0,0),6])
pbPushEnd(list)
list=event.pages[event.pages.length-1].list
list.clear
pbPushBranch(list,"get_character(0).onEvent?")
pbPushEvent(list,208,[0],1)
pbPushMoveRouteAndWait(list,0,[
PBMoveRoute::TurnLeft,PBMoveRoute::Wait,6],1)
pbPushEvent(list,208,[1],1)
pbPushMoveRouteAndWait(list,-1,[PBMoveRoute::Down],1)
pbPushMoveRouteAndWait(list,0,[
PBMoveRoute::TurnUp,PBMoveRoute::Wait,2,
PBMoveRoute::TurnRight,PBMoveRoute::Wait,2,
PBMoveRoute::TurnDown,PBMoveRoute::Wait,2],1)
pbPushBranchEnd(list,1)
pbPushScript(list,"setTempSwitchOn(\"A\")")
pbPushEnd(list)
changed=true
end
end
return changed
end
|
#pbUpdateMsgWindowPos(msgwindow, event, eventChanged = false) ⇒ Object
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
|
# File 'scripts/Messages.rb', line 1177
def pbUpdateMsgWindowPos(msgwindow,event,eventChanged=false)
if event
if eventChanged
msgwindow.resizeToFit2(msgwindow.text,Graphics.width*2/3,msgwindow.height)
end
msgwindow.y=event.screen_y-48-msgwindow.height
if msgwindow.y<0
msgwindow.y=event.screen_y+24
end
msgwindow.x=event.screen_x-(msgwindow.width/2)
msgwindow.x=0 if msgwindow.x<0
if msgwindow.x>Graphics.width-msgwindow.width
msgwindow.x=Graphics.width-msgwindow.width
end
else
curwidth=msgwindow.width
if curwidth!=Graphics.width
msgwindow.width=Graphics.width
msgwindow.width=Graphics.width
end
end
end
|
#pbUpdateSceneMap ⇒ Object
142
143
144
145
146
147
148
149
150
151
152
|
# File 'scripts/Messages.rb', line 142
def pbUpdateSceneMap
if $scene && $scene.is_a?(Scene_Map) && !pbIsFaded?
if $scene.respond_to?("miniupdate")
$scene.miniupdate
else
$scene.updatemini
end
elsif $scene && $scene.is_a?(Scene_Battle)
$scene.updatemini
end
end
|
#pbUpdateSpriteHash(windows) ⇒ Object
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
|
# File 'scripts/SpriteWindow.rb', line 1116
def pbUpdateSpriteHash(windows)
for i in windows
window=i[1]
if window
if window.is_a?(Sprite) || window.is_a?(Window)
window.update if !pbDisposed?(window)
elsif window.is_a?(Plane)
begin
window.update if !window.disposed?
rescue NoMethodError
end
elsif window.respond_to?("update")
begin
window.update
rescue RGSSError
end
end
end
end
end
|
#pbUseItem(bag, item, bagscene = nil) ⇒ Object
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
|
# File 'scripts/PItem_Items.rb', line 627
def pbUseItem(bag,item,bagscene=nil)
found=false
if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4 machine=$ItemData[item][ITEMMACHINE]
return 0 if machine==nil
if $Trainer.pokemonCount==0
Kernel.pbMessage(_INTL("No hay ningún Pokémon."))
return 0
end
movename=PBMoves.getName(machine)
if pbIsHiddenMachine?(item)
Kernel.pbMessage(_INTL("\\se[accesspc]MO iniciada."))
Kernel.pbMessage(_INTL("Ésta contiene {1}.\1",movename))
else
Kernel.pbMessage(_INTL("\\se[accesspc]MT iniciada."))
Kernel.pbMessage(_INTL("Ésta contiene {1}.\1",movename))
end
if !Kernel.pbConfirmMessage(_INTL("¿Quieres enseñarle {1} a un Pokémon?",movename))
return 0
elsif pbMoveTutorChoose(machine,nil,true)
bag.pbDeleteItem(item) if pbIsTechnicalMachine?(item) && !INFINITETMS
return 1
else
return 0
end
elsif $ItemData[item][ITEMUSE]==1 || $ItemData[item][ITEMUSE]==5 if $Trainer.pokemonCount==0
Kernel.pbMessage(_INTL("No hay ningún Pokémon."))
return 0
end
ret=false
annot=nil
if pbIsEvolutionStone?(item)
annot=[]
for pkmn in $Trainer.party
elig=(pbCheckEvolution(pkmn,item)>0)
annot.push(elig ? _INTL("APTO") : _INTL("NO APTO"))
end
end
pbFadeOutIn(99999){
scene=PokemonScreen_Scene.new
screen=PokemonScreen.new(scene,$Trainer.party)
screen.pbStartScene(_INTL("¿Usar con qué Pokémon?"),false,annot)
loop do
scene.pbSetHelpText(_INTL("¿Usar con qué Pokémon?"))
chosen=screen.pbChoosePokemon
if chosen>=0
pokemon=$Trainer.party[chosen]
if !pbCheckUseOnPokemon(item,pokemon,screen)
pbPlayBuzzerSE()
else
ret=ItemHandlers.triggerUseOnPokemon(item,pokemon,screen)
if ret && $ItemData[item][ITEMUSE]==1 bag.pbDeleteItem(item)
end
if bag.pbQuantity(item)<=0
Kernel.pbMessage(_INTL("Has usado el último {1}.",PBItems.getName(item)))
break
end
end
else
ret=false
break
end
end
screen.pbEndScene
bagscene.pbRefresh if bagscene
}
return ret ? 1 : 0
elsif $ItemData[item][ITEMUSE]==2 intret=ItemHandlers.triggerUseFromBag(item)
case intret
when 0
return 0
when 1 return 1
when 2 return 2
when 3 bag.pbDeleteItem(item)
return 1
when 4 bag.pbDeleteItem(item)
return 2
else
Kernel.pbMessage(_INTL("No puede usarse aquí."))
return 0
end
else
Kernel.pbMessage(_INTL("No puede usarse aquí."))
return 0
end
end
|
#pbUseItemOnPokemon(item, pokemon, scene) ⇒ Object
Only called when in the party screen and having chosen an item to be used on the selected Pokémon
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
|
# File 'scripts/PItem_Items.rb', line 585
def pbUseItemOnPokemon(item,pokemon,scene)
if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4 machine=$ItemData[item][ITEMMACHINE]
return false if machine==nil
movename=PBMoves.getName(machine)
if (pokemon.isShadow? rescue false)
Kernel.pbMessage(_INTL("No se le puede enseñar ningún movimiento a un Pokémon Oscuro."))
elsif !pokemon.isCompatibleWithMove?(machine)
Kernel.pbMessage(_INTL("{1} y {2} no son compatibles.",pokemon.name,movename))
Kernel.pbMessage(_INTL("{1} no puede ser aprendido.",movename))
else
if pbIsHiddenMachine?(item)
Kernel.pbMessage(_INTL("\\se[accesspc]MO iniciada."))
Kernel.pbMessage(_INTL("Ésta contiene {1}.\1",movename))
else
Kernel.pbMessage(_INTL("\\se[accesspc]MT iniciada."))
Kernel.pbMessage(_INTL("Ésta contiene {1}.\1",movename))
end
if Kernel.pbConfirmMessage(_INTL("¿Quieres enseñarle {1} a {2}?",movename,pokemon.name))
if pbLearnMove(pokemon,machine,false,true)
$PokemonBag.pbDeleteItem(item) if pbIsTechnicalMachine?(item) && !INFINITETMS
return true
end
end
end
return false
else
ret=ItemHandlers.triggerUseOnPokemon(item,pokemon,scene)
scene.pbClearAnnotations
scene.pbHardRefresh
if ret && $ItemData[item][ITEMUSE]==1 $PokemonBag.pbDeleteItem(item)
end
if $PokemonBag.pbQuantity(item)<=0
Kernel.pbMessage(_INTL("Has usado el último {1}.",PBItems.getName(item)))
end
return ret
end
Kernel.pbMessage(_INTL("No se puede usar eso en {1}.",pokemon.name))
return false
end
|
#pbUseKeyItem ⇒ Object
2159
2160
2161
2162
2163
2164
2165
|
# File 'scripts/PField_Field.rb', line 2159
def pbUseKeyItem
if $PokemonBag.registeredItem==0
Kernel.pbMessage(_INTL("Un Objeto Clave de la Mochila puede ser registrado a esta tecla para su uso rápido."))
else
Kernel.pbUseKeyItemInField($PokemonBag.registeredItem)
end
end
|
#pbUsePokeRadar ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'scripts/PItem_PokeRadar.rb', line 43
def pbUsePokeRadar
if pbCanUsePokeRadar?
$PokemonTemp.pokeradar=[0,0,0,[]] if !$PokemonTemp.pokeradar
$PokemonGlobal.pokeradarBattery=50
pbPokeRadarHighlightGrass
return true
end
return false
end
|
#pbVoltorbFlip ⇒ Object
618
619
620
621
622
623
624
625
626
627
628
|
# File 'scripts/PMinigame_VoltorbFlip.rb', line 618
def pbVoltorbFlip
if hasConst?(PBItems,:COINCASE) && $PokemonBag.pbQuantity(:COINCASE)<=0
Kernel.pbMessage(_INTL("No puedes jugar hasta que consigas una Caja de Fichas."))
elsif $PokemonGlobal.coins==MAXCOINS
Kernel.pbMessage(_INTL("¡Tu Caja de Fichas está llena!"))
else
scene=VoltorbFlip.new
screen=VoltorbFlipScreen.new(scene)
screen.pbStartScreen
end
end
|
#pbWait(numframes) ⇒ Object
#pbWaitMessage(msgwindow, time) ⇒ Object
#pbWarpToMap ⇒ Object
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
# File 'scripts/Debug.rb', line 202
def pbWarpToMap()
mapid=pbListScreen(_INTL("SALTAR A MAPA"),MapLister.new(pbDefaultMap()))
if mapid>0
map=Game_Map.new
map.setup(mapid)
success=false
x=0
y=0
100.times do
x=rand(map.width)
y=rand(map.height)
next if !map.passableStrict?(x,y,$game_player)
blocked=false
for event in map.events.values
if event.x == x && event.y == y && !event.through
blocked=true if self != $game_player || event.character_name != ""
end
end
next if blocked
success=true
break
end
if !success
x=rand(map.width)
y=rand(map.height)
end
return [mapid,x,y]
end
return nil
end
|
#pbWildBattle(species, level, variable = nil, canescape = true, canlose = false) ⇒ Object
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
|
# File 'scripts/PField_Field.rb', line 872
def pbWildBattle(species,level,variable=nil,canescape=true,canlose=false)
if (Input.press?(Input::CTRL) && $DEBUG) || $Trainer.pokemonCount==0
if $Trainer.pokemonCount>0
Kernel.pbMessage(_INTL("SALTANDO BATALLA..."))
end
pbSet(variable,1)
$PokemonGlobal.nextBattleBGM=nil
$PokemonGlobal.nextBattleME=nil
$PokemonGlobal.nextBattleBack=nil
return true
end
if species.is_a?(String) || species.is_a?(Symbol)
species=getID(PBSpecies,species)
end
handled=[nil]
Events.onWildBattleOverride.trigger(nil,species,level,handled)
if handled[0]!=nil
return handled[0]
end
currentlevels=[]
for i in $Trainer.party
currentlevels.push(i.level)
end
genwildpoke=pbGenerateWildPokemon(species,level)
Events.onStartBattle.trigger(nil,genwildpoke)
scene=pbNewBattleScene
battle=PokeBattle_Battle.new(scene,$Trainer.party,[genwildpoke],$Trainer,nil)
battle.internalbattle=true
battle.cantescape=!canescape
pbPrepareBattle(battle)
decision=0
pbBattleAnimation(pbGetWildBattleBGM(species)) {
pbSceneStandby {
decision=battle.pbStartBattle(canlose)
}
for i in $Trainer.party; (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); (i.revertOtherForms rescue nil); end
if $PokemonGlobal.partner
pbHealAll
for i in $PokemonGlobal.partner[3]
i.heal
(i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); (i.revertOtherForms rescue nil);
end
end
if decision==2 || decision==5 if canlose
for i in $Trainer.party;
i.heal;
(i.makeUnmega rescue nil); (i.makeUnprimal rescue nil); (i.revertOtherForms rescue nil);
end
for i in 0...10
Graphics.update
end
end
end
Events.onEndBattle.trigger(nil,decision,canlose)
}
Input.update
pbSet(variable,decision)
Events.onWildBattleEnd.trigger(nil,species,level,decision)
return (decision!=2)
end
|
#pbWriteCsvRecord(record, file, schema) ⇒ Object
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
|
# File 'scripts/Compiler.rb', line 552
def pbWriteCsvRecord(record,file,schema)
if !record.is_a?(Array)
rec=[record]
else
rec=record.clone
end
for i in 0...schema[1].length
chr=schema[1][i,1]
file.write(",") if i>0
if rec[i].nil?
elsif rec[i].is_a?(String)
file.write(csvquote(rec[i]))
elsif rec[i]==true
file.write("true")
elsif rec[i]==false
file.write("false")
elsif rec[i].is_a?(Numeric)
case chr
when "e"
enumer=schema[2+i]
if enumer.is_a?(Array)
file.write(enumer[rec[i]])
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
mod=Object.const_get(enumer.to_sym)
if enumer.to_s=="PBTrainers" && !mod.respond_to?("getCount")
file.write((getConstantName(mod,rec[i]) rescue pbGetTrainerConst(rec[i])))
else
file.write(getConstantName(mod,rec[i]))
end
elsif enumer.is_a?(Module)
file.write(getConstantName(enumer,rec[i]))
elsif enumer.is_a?(Hash)
for key in enumer.keys
if enumer[key]==rec[i]
file.write(key)
break
end
end
end
else
file.write(rec[i].inspect)
end
else
file.write(rec[i].inspect)
end
end
return record
end
|
#pbWriteCup(id, rules) ⇒ Object
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
|
# File 'scripts/PBattle_OrgBattleGenerator.rb', line 1429
def pbWriteCup(id,rules)
return if !$DEBUG
bttrainers=[]
trlists=(load_data("Data/trainerlists.dat") rescue [])
list=[]
for i in 0...trlists.length
tr=trlists[i]
if tr[5]
list.push("*"+(tr[3].sub(/\.txt$/,"")))
else
list.push((tr[3].sub(/\.txt$/,"")))
end
end
cmd=0
if trlists.length!=0
cmd=Kernel.pbMessage(_INTL("¿Generar equipos de Pokémon para este desafío?"),
[_INTL("NO"),_INTL("SI, USAR EXISTENTE"),_INTL("SI, USAR NUEVO")],1)
else
cmd=Kernel.pbMessage(_INTL("¿Generar equipos de Pokémon para este desafío?"),
[_INTL("SI"),_INTL("NO")],2)
if cmd==0
cmd=2
elsif cmd==1
cmd=0
end
end
return if cmd==0 if cmd==1 cmd=Kernel.pbMessage(_INTL("Elegir el desafío."),list,-1)
if cmd>=0
Kernel.pbMessage(_INTL("Este desafío usará la lista de Pokémon de {1}.",list[cmd]))
for i in 0...trlists.length
tr=trlists[i]
while !tr[5] && tr[2].include?(id)
tr[2].delete(id)
end
end
if !trlists[cmd][5]
trlists[cmd][2].push(id)
end
save_data(trlists,"Data/trainerlists.dat")
Graphics.update
pbSaveTrainerLists()
Graphics.update
return
else
return
end
elsif cmd==2 && !Kernel.pbConfirmMessage(_INTL("Esto podría tomar un buen tiempo. ¿Estás seguro?"))
return
end
mw=Kernel.pbCreateMessageWindow
t=Time.now
pbGenerateChallenge(rules,id){|message|
if (Time.now-t)>=5
Graphics.update; t=Time.now
end
if message
Kernel.pbMessageDisplay(mw,message,false)
Graphics.update; t=Time.now
end
}
Kernel.pbDisposeMessageWindow(mw)
Kernel.pbMessage(_INTL("Generación de equipos completada."))
end
|
#pbWriteDefaultTypes ⇒ Object
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
|
# File 'scripts/Compiler.rb', line 1033
def pbWriteDefaultTypes
if !safeExists?("PBS/types.txt")
File.open("PBS/types.txt","w"){|f|
f.write(0xEF.chr)
f.write(0xBB.chr)
f.write(0xBF.chr)
fx=<<END
[0]
Name=Normal
InternalName=NORMAL
Weaknesses=FIGHTING
Immunities=GHOST
[1]
Name=Lucha
InternalName=FIGHTING
Weaknesses=FLYING,PSYCHIC
Resistances=ROCK,BUG,DARK
[2]
Name=Volador
InternalName=FLYING
Weaknesses=ROCK,ELECTRIC,ICE
Resistances=FIGHTING,BUG,GRASS
Immunities=GROUND
[3]
Name=Veneno
InternalName=POISON
Weaknesses=GROUND,PSYCHIC
Resistances=FIGHTING,POISON,BUG,GRASS
[4]
Name=Tierra
InternalName=GROUND
Weaknesses=WATER,GRASS,ICE
Resistances=POISON,ROCK
Immunities=ELECTRIC
[5]
Name=Roca
InternalName=ROCK
Weaknesses=FIGHTING,GROUND,STEEL,WATER,GRASS
Resistances=NORMAL,FLYING,POISON,FIRE
[6]
Name=Bicho
InternalName=BUG
Weaknesses=FLYING,ROCK,FIRE
Resistances=FIGHTING,GROUND,GRASS
[7]
Name=Fantasma
InternalName=GHOST
Weaknesses=GHOST,DARK
Resistances=POISON,BUG
Immunities=NORMAL,FIGHTING
[8]
Name=Acero
InternalName=STEEL
Weaknesses=FIGHTING,GROUND,FIRE
Resistances=NORMAL,FLYING,ROCK,BUG,GHOST,STEEL,GRASS,PSYCHIC,ICE,DRAGON,DARK
Immunities=POISON
[9]
Name=???
InternalName=QMARKS
IsPseudoType=true
[10]
Name=Fuego
InternalName=FIRE
IsSpecialType=true
Weaknesses=GROUND,ROCK,WATER
Resistances=BUG,STEEL,FIRE,GRASS,ICE
[11]
Name=Agua
InternalName=WATER
IsSpecialType=true
Weaknesses=GRASS,ELECTRIC
Resistances=STEEL,FIRE,WATER,ICE
[12]
Name=Planta
InternalName=GRASS
IsSpecialType=true
Weaknesses=FLYING,POISON,BUG,FIRE,ICE
Resistances=GROUND,WATER,GRASS,ELECTRIC
[13]
Name=Eléctrico
InternalName=ELECTRIC
IsSpecialType=true
Weaknesses=GROUND
Resistances=FLYING,STEEL,ELECTRIC
[14]
Name=Psíquico
InternalName=PSYCHIC
IsSpecialType=true
Weaknesses=BUG,GHOST,DARK
Resistances=FIGHTING,PSYCHIC
[15]
Name=Hielo
InternalName=ICE
IsSpecialType=true
Weaknesses=FIGHTING,ROCK,STEEL,FIRE
Resistances=ICE
[16]
Name=Dragón
InternalName=DRAGON
IsSpecialType=true
Weaknesses=ICE,DRAGON
Resistances=FIRE,WATER,GRASS,ELECTRIC
[17]
Name=Siniestro
InternalName=DARK
IsSpecialType=true
Weaknesses=FIGHTING,BUG
Resistances=GHOST,DARK
Immunities=PSYCHIC
END
f.write(fx)
}
end
end
|
#pokeballThrow(ball, shakes, critical, targetBattler, scene, battler, burst = -1,, showplayer = false) ⇒ Object
Shows the player's Poké Ball being thrown to capture a Pokémon.
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
|
# File 'scripts/PokeBattle_Scene.rb', line 1159
def pokeballThrow(ball,shakes,critical,targetBattler,scene,battler,burst=-1,showplayer=false)
balltype=pbGetBallType(ball)
animtrainer=false
if showplayer && @sprites["player"].bitmap.width>@sprites["player"].bitmap.height
animtrainer=true
end
oldvisible=@sprites["shadow#{targetBattler}"].visible
@sprites["shadow#{targetBattler}"].visible=false
ball=sprintf("Graphics/Pictures/ball%02d",balltype)
ballopen=sprintf("Graphics/Pictures/ball%02d_open",balltype)
spritePoke=@sprites["pokemon#{targetBattler}"]
spriteBall=IconSprite.new(0,0,@viewport)
spriteBall.visible=false
spritePlayer=@sprites["player"] if animtrainer
pictureBall=PictureEx.new(spritePoke.z+1)
picturePoke=PictureEx.new(spritePoke.z)
dims=[spritePoke.x,spritePoke.y]
center=getSpriteCenter(@sprites["pokemon#{targetBattler}"])
if @battle.doublebattle
ballendy=PokeBattle_SceneConstants::FOEBATTLERD1_Y-4 if targetBattler==1
ballendy=PokeBattle_SceneConstants::FOEBATTLERD2_Y-4 if targetBattler==3
else
ballendy=PokeBattle_SceneConstants::FOEBATTLER_Y-4
end
if animtrainer
picturePlayer=PictureEx.new(spritePoke.z+2)
playerpos=[@sprites["player"].x,@sprites["player"].y]
end
pictureBall.moveVisible(1,true)
pictureBall.moveName(1,ball)
pictureBall.moveOrigin(1,PictureOrigin::Center)
if animtrainer
pictureBall.moveXY(0,1,64,256)
else
pictureBall.moveXY(0,1,10,180)
end
picturePoke.moveVisible(1,true)
picturePoke.moveOrigin(1,PictureOrigin::Center)
picturePoke.moveXY(0,1,center[0],center[1])
if animtrainer
picturePlayer.moveVisible(1,true)
picturePlayer.moveName(1,spritePlayer.name)
picturePlayer.moveOrigin(1,PictureOrigin::TopLeft)
picturePlayer.moveXY(0,1,playerpos[0],playerpos[1])
end
picturePoke.moveSE(1,"Audio/SE/throw")
if animtrainer
pictureBall.moveCurve(30,1,64,256,30+Graphics.width/2,10,center[0],center[1])
pictureBall.moveAngle(30,1,-720)
else
pictureBall.moveCurve(30,1,150,70,30+Graphics.width/2,10,center[0],center[1])
pictureBall.moveAngle(30,1,-1080)
end
pictureBall.moveAngle(0,pictureBall.totalDuration,0)
delay=pictureBall.totalDuration+4
picturePoke.moveTone(10,delay,Tone.new(0,-224,-224,0))
delay=picturePoke.totalDuration
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay+4,ballopen)
if animtrainer
picturePlayer.moveSrc(1,@sprites["player"].bitmap.height,0)
picturePlayer.moveXY(0,1,playerpos[0]-14,playerpos[1])
picturePlayer.moveSrc(4,@sprites["player"].bitmap.height*2,0)
picturePlayer.moveXY(0,4,playerpos[0]-12,playerpos[1])
picturePlayer.moveSrc(8,@sprites["player"].bitmap.height*3,0)
picturePlayer.moveXY(0,8,playerpos[0]+20,playerpos[1])
picturePlayer.moveSrc(16,@sprites["player"].bitmap.height*4,0)
picturePlayer.moveXY(0,16,playerpos[0]+16,playerpos[1])
picturePlayer.moveSrc(40,0,0)
picturePlayer.moveXY(0,40,playerpos[0],playerpos[1])
end
loop do
pictureBall.update
picturePoke.update
picturePlayer.update if animtrainer
setPictureIconSprite(spriteBall,pictureBall)
setPictureSprite(spritePoke,picturePoke)
setPictureIconSprite(spritePlayer,picturePlayer) if animtrainer
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate
break if !pictureBall.running? && !picturePoke.running?
end
if burst>=0 && scene.battle.battlescene
scene.pbCommonAnimation("BallBurst#{burst}",battler,nil)
end
pictureBall.clearProcesses
picturePoke.clearProcesses
delay=0
picturePoke.moveZoom(15,delay,0)
picturePoke.moveXY(15,delay,center[0],center[1])
picturePoke.moveSE(delay+10,"Audio/SE/jumptoball")
picturePoke.moveVisible(delay+15,false)
pictureBall.moveName(picturePoke.totalDuration+2,ball)
delay=pictureBall.totalDuration+6
if critical
pictureBall.moveSE(delay,"Audio/SE/ballshake")
pictureBall.moveXY(2,delay,center[0]+4,center[1])
pictureBall.moveXY(4,pictureBall.totalDuration,center[0]-4,center[1])
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/ballshake")
pictureBall.moveXY(4,pictureBall.totalDuration,center[0]+4,center[1])
pictureBall.moveXY(4,pictureBall.totalDuration,center[0]-4,center[1])
pictureBall.moveXY(2,pictureBall.totalDuration,center[0],center[1])
delay=pictureBall.totalDuration+4
end
pictureBall.moveXY(10,delay,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(5,pictureBall.totalDuration+2,center[0],ballendy-((ballendy-center[1])/2))
pictureBall.moveXY(5,pictureBall.totalDuration+2,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(3,pictureBall.totalDuration+2,center[0],ballendy-((ballendy-center[1])/4))
pictureBall.moveXY(3,pictureBall.totalDuration+2,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
pictureBall.moveXY(1,pictureBall.totalDuration+2,center[0],ballendy-((ballendy-center[1])/8))
pictureBall.moveXY(1,pictureBall.totalDuration+2,center[0],ballendy)
pictureBall.moveSE(pictureBall.totalDuration,"Audio/SE/balldrop")
picturePoke.moveXY(0,pictureBall.totalDuration,center[0],ballendy)
delay=pictureBall.totalDuration+18 [shakes,3].min.times do
pictureBall.moveSE(delay,"Audio/SE/ballshake")
pictureBall.moveXY(3,delay,center[0]-8,ballendy)
pictureBall.moveAngle(3,delay,20) delay=pictureBall.totalDuration
pictureBall.moveXY(6,delay,center[0]+8,ballendy)
pictureBall.moveAngle(6,delay,-20) delay=pictureBall.totalDuration
pictureBall.moveXY(3,delay,center[0],ballendy)
pictureBall.moveAngle(3,delay,0)
delay=pictureBall.totalDuration+18
end
if shakes<4
picturePoke.moveSE(delay,"Audio/SE/recall")
pictureBall.moveName(delay,ballopen)
pictureBall.moveVisible(delay+10,false)
picturePoke.moveVisible(delay,true)
picturePoke.moveZoom(15,delay,100)
picturePoke.moveXY(15,delay,center[0],center[1])
picturePoke.moveTone(0,delay,Tone.new(248,248,248,248))
picturePoke.moveTone(24,delay,Tone.new(0,0,0,0))
delay=picturePoke.totalDuration
end
pictureBall.moveXY(0,delay,center[0],ballendy)
picturePoke.moveOrigin(picturePoke.totalDuration,PictureOrigin::TopLeft)
picturePoke.moveXY(0,picturePoke.totalDuration,dims[0],dims[1])
loop do
pictureBall.update
picturePoke.update
setPictureIconSprite(spriteBall,pictureBall)
setPictureSprite(spritePoke,picturePoke)
pbGraphicsUpdate
pbInputUpdate
pbFrameUpdate
break if !pictureBall.running? && !picturePoke.running?
end
if shakes<4
@sprites["shadow#{targetBattler}"].visible=oldvisible
spriteBall.dispose
else
spriteBall.tone=Tone.new(-64,-64,-64,128)
pbSEPlay("balldrop",100,150)
@sprites["capture"]=spriteBall
spritePoke.visible=false
end
end
|
#prepline(line) ⇒ Object
162
163
164
165
166
|
# File 'scripts/Compiler.rb', line 162
def prepline(line)
line.sub!(/\s*\#.*$/,"")
line.sub!(/\s+$/,"")
return line
end
|
#readItemList(filename) ⇒ Object
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
|
# File 'scripts/Compiler.rb', line 1584
def readItemList(filename)
ret=ItemList.new
if !pbRgssExists?(filename)
return ret
end
pbRgssOpen(filename,"rb"){|file|
numrec=file.fgetdw>>3
curpos=0
for i in 0...numrec
file.pos=curpos
offset=file.fgetdw
length=file.fgetdw
record=SerialRecord.decode(file,offset,length)
ret[record[0]]=record
curpos+=8
end
}
return ret
end
|
#readSerialRecords(filename) ⇒ Object
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
|
# File 'scripts/Compiler.rb', line 872
def readSerialRecords(filename)
ret=[]
if !pbRgssExists?(filename)
return ret
end
pbRgssOpen(filename,"rb"){|file|
numrec=file.fgetdw>>3
curpos=0
for i in 0...numrec
file.pos=curpos
offset=file.fgetdw
length=file.fgetdw
record=SerialRecord.decode(file,offset,length)
ret.push(record)
curpos+=8
end
}
return ret
end
|
#removeConstantValue(mod, value) ⇒ Object
710
711
712
713
714
715
716
|
# File 'scripts/Compiler.rb', line 710
def removeConstantValue(mod,value)
for c in mod.constants
if mod.const_get(c.to_sym)==value
mod.send(:remove_const,c.to_sym)
end
end
end
|
#renderLineBrokenChunks(bitmap, xDst, yDst, normtext, maxheight = 0) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'scripts/DrawText.rb', line 57
def renderLineBrokenChunks(bitmap,xDst,yDst,normtext,maxheight=0)
for i in 0...normtext.length
width=normtext[i][3]
textx=normtext[i][1]+xDst
texty=normtext[i][2]+yDst
if maxheight==0 || normtext[i][2]<maxheight
bitmap.font.color=normtext[i][5]
bitmap.draw_text(textx,texty,width+2,normtext[i][4],normtext[i][0])
end
end
end
|
#renderLineBrokenChunksWithShadow(bitmap, xDst, yDst, normtext, maxheight, baseColor, shadowColor) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'scripts/DrawText.rb', line 69
def renderLineBrokenChunksWithShadow(bitmap,xDst,yDst,normtext,maxheight,baseColor,shadowColor)
for i in 0...normtext.length
width=normtext[i][3]
textx=normtext[i][1]+xDst
texty=normtext[i][2]+yDst
if maxheight==0 || normtext[i][2]<maxheight
height=normtext[i][4]
text=normtext[i][0]
bitmap.font.color=shadowColor
bitmap.draw_text(textx+2,texty,width+2,height,text)
bitmap.draw_text(textx,texty+2,width+2,height,text)
bitmap.draw_text(textx+2,texty+2,width+2,height,text)
bitmap.font.color=baseColor
bitmap.draw_text(textx,texty,width+2,height,text)
end
end
end
|
#renderMultiLine(bitmap, xDst, yDst, normtext, maxheight, baseColor, shadowColor) ⇒ Object
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
|
# File 'scripts/DrawText.rb', line 1083
def renderMultiLine(bitmap,xDst,yDst,normtext,maxheight,baseColor,shadowColor)
for i in 0...normtext.length
width=normtext[i][3]
textx=normtext[i][1]+xDst
texty=normtext[i][2]+yDst
if shadowColor
height=normtext[i][4]
text=normtext[i][0]
bitmap.font.color=shadowColor
bitmap.draw_text(textx-2,texty-2,width,height,text,0)
bitmap.draw_text(textx,texty-2,width,height,text,0)
bitmap.draw_text(textx+2,texty-2,width,height,text,0)
bitmap.draw_text(textx-2,texty,width,height,text,0)
bitmap.draw_text(textx+2,texty,width,height,text,0)
bitmap.draw_text(textx-2,texty+2,width,height,text,0)
bitmap.draw_text(textx,texty+2,width,height,text,0)
bitmap.draw_text(textx+2,texty+2,width,height,text,0)
end
if baseColor
height=normtext[i][4]
text=normtext[i][0]
bitmap.font.color=baseColor
bitmap.draw_text(textx,texty,width,height,text,0)
end
end
end
|
#repositionY(x1, y1, x2, y2, tx, ty) ⇒ Object
9
10
11
12
13
14
15
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 9
def repositionY(x1,y1,x2,y2,tx,ty)
dx=x2-x1
dy=y2-y1
x=x1+tx*dx*1.0
y=y1+ty*dy*1.0
return [x,y]
end
|
#Rgb16ToColor(param) ⇒ Object
190
191
192
193
194
195
196
197
|
# File 'scripts/DrawText.rb', line 190
def Rgb16ToColor(param)
baseint=param.to_i(16)
return Color.new(
((baseint)&0x1F)<<3,
((baseint>>5)&0x1F)<<3,
((baseint>>10)&0x1F)<<3
)
end
|
#rgbToColor(param) ⇒ Object
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'scripts/DrawText.rb', line 121
def rgbToColor(param)
return Font.default_color if !param
baseint=param.to_i(16)
if param.length==8 return Color.new(
(baseint>>24)&0xFF,
(baseint>>16)&0xFF,
(baseint>>8)&0xFF,
(baseint)&0xFF
)
elsif param.length==6 return Color.new(
(baseint>>16)&0xFF,
(baseint>>8)&0xFF,
(baseint)&0xFF
)
elsif param.length==4 return Color.new(
((baseint)&0x1F)<<3,
((baseint>>5)&0x1F)<<3,
((baseint>>10)&0x1F)<<3
)
elsif param.length==1 i=param.to_i
return Font.default_color if i>=8
return [
Color.new(255, 255, 255, 255),
Color.new(128, 128, 255, 255),
Color.new(255, 128, 128, 255),
Color.new(128, 255, 128, 255),
Color.new(128, 255, 255, 255),
Color.new(255, 128, 255, 255),
Color.new(255, 255, 128, 255),
Color.new(192, 192, 192, 255)
][i]
else
return Font.default_color
end
end
|
#safeExists?(f) ⇒ Boolean
Works around a problem with FileTest.exist if path contains accent marks
65
66
67
68
69
|
# File 'scripts/Audio.rb', line 65
def safeExists?(f)
ret=false
File.open(f,"rb") { ret=true } rescue nil
return ret
end
|
#safeGlob(dir, wildcard) ⇒ Object
Similar to “Dir.glob”, but designed to work around a problem with accessing files if a path contains accent marks. “dir” is the directory path, “wildcard” is the filename pattern to match.
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
# File 'scripts/SpriteWindow.rb', line 160
def safeGlob(dir,wildcard)
ret=[]
afterChdir=false
begin
Dir.chdir(dir){
afterChdir=true
Dir.glob(wildcard){|f|
ret.push(dir+"/"+f)
}
}
rescue Errno::ENOENT
raise if afterChdir
end
if block_given?
ret.each{|f|
yield(f)
}
end
return (block_given?) ? nil : ret
end
|
#safeIsDirectory?(f) ⇒ Boolean
Works around a problem with FileTest.directory if directory contains accent marks
137
138
139
140
141
|
# File 'scripts/SpriteWindow.rb', line 137
def safeIsDirectory?(f)
ret=false
Dir.chdir(f) { ret=true } rescue nil
return ret
end
|
#safequote(x) ⇒ Object
2835
2836
2837
2838
2839
2840
2841
|
# File 'scripts/Compiler.rb', line 2835
def safequote(x)
x=x.gsub(/\"\#\'\\/){|a| "\\"+a }
x=x.gsub(/\t/,"\\t")
x=x.gsub(/\r/,"\\r")
x=x.gsub(/\n/,"\\n")
return x
end
|
#safequote2(x) ⇒ Object
2843
2844
2845
2846
2847
2848
2849
|
# File 'scripts/Compiler.rb', line 2843
def safequote2(x)
x=x.gsub(/\"\#\'\\/){|a| "\\"+a }
x=x.gsub(/\t/,"\\t")
x=x.gsub(/\r/,"\\r")
x=x.gsub(/\n/," ")
return x
end
|
#setConstantName(mod, value, name) ⇒ Object
718
719
720
721
722
723
724
725
|
# File 'scripts/Compiler.rb', line 718
def setConstantName(mod,value,name)
for c in mod.constants
if mod.const_get(c.to_sym)==value
mod.send(:remove_const,c.to_sym)
end
end
mod.const_set(name,value)
end
|
#setPictureIconSprite(sprite, picture) ⇒ Object
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
# File 'scripts/EventScene.rb', line 417
def setPictureIconSprite(sprite,picture)
if sprite.name != picture.name
sprite.name = picture.name
end
if sprite.src_rect
if sprite.src_rect.x != picture.src_x
sprite.src_rect.x = picture.src_x
end
if sprite.src_rect.y != picture.src_y
sprite.src_rect.y = picture.src_y
end
end
setPictureSprite(sprite,picture)
end
|
#setPictureSprite(sprite, picture) ⇒ Object
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
# File 'scripts/EventScene.rb', line 432
def setPictureSprite(sprite,picture)
sprite.visible = picture.visible
case picture.origin
when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight
sprite.oy=0
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
sprite.oy=(sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.bitmap.height/2 : 0
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
sprite.oy=(sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.bitmap.height : 0
end
case picture.origin
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
sprite.ox=0
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
sprite.ox=(sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.bitmap.width/2 : 0
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
sprite.ox=(sprite.bitmap && !sprite.bitmap.disposed?) ? sprite.bitmap.width : 0
end
sprite.x = picture.x
sprite.y = picture.y
sprite.z = picture.number
sprite.zoom_x = picture.zoom_x / 100.0
sprite.zoom_y = picture.zoom_y / 100.0
sprite.opacity = picture.opacity
sprite.blend_type = picture.blend_type
angle = picture.angle
sprite.tone = picture.tone
sprite.color = picture.color
while angle < 0
angle += 360
end
angle %= 360
sprite.angle=angle
end
|
#setScreenBorderName(border) ⇒ Object
29
|
# File 'scripts/PSystem_System.rb', line 29
def setScreenBorderName(border); end
|
#shadowc3tag(base, shadow) ⇒ Object
91
92
93
|
# File 'scripts/DrawText.rb', line 91
def shadowc3tag(base,shadow)
return sprintf("<c3=%s,%s>",colorToRgb32(base),colorToRgb32(shadow))
end
|
#shadowctag(base, shadow) ⇒ Object
87
88
89
|
# File 'scripts/DrawText.rb', line 87
def shadowctag(base,shadow)
return sprintf("<c2=%s%s>",colorToRgb16(base),colorToRgb16(shadow))
end
|
#shadowctagFromColor(color) ⇒ Object
186
187
188
|
# File 'scripts/DrawText.rb', line 186
def shadowctagFromColor(color)
return shadowc3tag(color,getContrastColor(color))
end
|
#shadowctagFromRgb(param) ⇒ Object
#showShadow?(species) ⇒ Boolean
406
407
408
409
|
# File 'scripts/Pokemon_Sprites.rb', line 406
def showShadow?(species)
metrics=load_data("Data/metrics.dat")
return metrics[2][species]>0
end
|
#strSize(str) ⇒ Object
638
639
640
|
# File 'scripts/Compiler.rb', line 638
def strSize(str)
return str.length+intSize(str.length)
end
|
#strsplit(str, re) ⇒ Object
652
653
654
655
656
657
658
659
660
661
|
# File 'scripts/Compiler.rb', line 652
def strsplit(str,re)
ret=[]
tstr=str
while re=~tstr
ret[ret.length]=$~.pre_match
tstr=$~.post_match
end
ret[ret.length]=tstr if ret.length
return ret
end
|
#toUnformattedText(text) ⇒ Object
214
215
216
217
218
219
220
221
222
|
# File 'scripts/DrawText.rb', line 214
def toUnformattedText(text)
text2=text.gsub(FORMATREGEXP,"")
text2.gsub!(/</,"<")
text2.gsub!(/>/,">")
text2.gsub!(/'/,"'")
text2.gsub!(/"/,"\"")
text2.gsub!(/&/,"&")
return text2
end
|
17
18
19
20
21
22
23
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 17
def transformPoint(x1,y1,x2,y2, x3,y3,x4,y4, px,py) ret=yaxisIntersect(x1,y1,x2,y2,px,py)
ret2=repositionY(x3,y3,x4,y4,ret[0],ret[1])
return ret2
end
|
#tryLoadData(file) ⇒ Object
2891
2892
2893
2894
2895
2896
2897
|
# File 'scripts/BattleAnimationEditor.rb', line 2891
def tryLoadData(file)
begin
return load_data(file)
rescue
return nil
end
end
|
#unformattedTextLength(text) ⇒ Object
224
225
226
|
# File 'scripts/DrawText.rb', line 224
def unformattedTextLength(text)
return toUnformattedText(text).scan(/./m).length
end
|
#updateTilesets ⇒ Object
129
130
131
132
133
134
|
# File 'scripts/PField_MapFactory.rb', line 129
def updateTilesets
maps=$MapFactory.maps
for map in maps
map.updateTileset if map
end
end
|
#using(window) ⇒ Object
989
990
991
992
993
994
995
|
# File 'scripts/SpriteWindow.rb', line 989
def using(window)
begin
yield if block_given?
ensure
window.dispose
end
end
|
#withRestr(rule, minbs, maxbs, legendary) ⇒ Object
#writeConnectionPoint(map1, x1, y1, map2, x2, y2) ⇒ Object
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
|
# File 'scripts/Editor.rb', line 673
def writeConnectionPoint(map1,x1,y1,map2,x2,y2)
dims1=MapFactoryHelper.getMapDims(map1)
dims2=MapFactoryHelper.getMapDims(map2)
if x1==0 && x2==dims2[0]
return sprintf("%d,West,%d,%d,East,%d\r\n",map1,y1,map2,y2)
elsif y1==0 && y2==dims2[1]
return sprintf("%d,North,%d,%d,South,%d\r\n",map1,x1,map2,x2)
elsif x1==dims1[0] && x2==0
return sprintf("%d,East,%d,%d,West,%d\r\n",map1,y1,map2,y2)
elsif y1==dims1[1] && y2==0
return sprintf("%d,South,%d,%d,North,%d\r\n",map1,x1,map2,x2)
else
return sprintf("%d,%d,%d,%d,%d,%d\r\n",map1,x1,y1,map2,x2,y2)
end
end
|
#writeSerialRecords(filename, records) ⇒ Object
892
893
894
895
896
897
898
899
900
901
902
903
904
905
|
# File 'scripts/Compiler.rb', line 892
def writeSerialRecords(filename,records)
File.open(filename,"wb"){|file|
totalsize=records.length*8
for record in records
file.fputdw(totalsize)
bytesize=record.bytesize
file.fputdw(bytesize)
totalsize+=bytesize
end
for record in records
record.encode(file)
end
}
end
|
#XPML_read(map, markup, event, max_param_number = 0) ⇒ Object
? XPML Definition, by Rataime, using ideas from Near Fantastica
Returns nil if the markup wasn't present at all,
returns [] if there wasn't any parameters, else
returns a parameters list with "int" converted as int
eg :
begin first
begin second
param1 1
param2 two
begin third
anything 3
p XPML_read("first", event_id) -> []
p XPML_read("second", event_id) -> [1,"two"]
p XPML_read("third", event_id) -> [3]
p XPML_read("forth", event_id) -> nil
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
# File 'scripts/DynamicShadows.rb', line 248
def XPML_read(map,markup,event,max_param_number=0)
parameter_list = nil
return nil if !event || event.list==nil
for i in 0...event.list.size
if event.list[i].code == 108 and
event.list[i].parameters[0].downcase == "begin "+markup.downcase
parameter_list = [] if parameter_list == nil
for j in i+1...event.list.size
if event.list[j].code == 108
parts = event.list[j].parameters[0].split
if parts.size!=1 and parts[0].downcase!="begin"
if parts[1].to_i!=0 or parts[1]=="0"
parameter_list.push(parts[1].to_i)
else
parameter_list.push(parts[1])
end
else
return parameter_list
end
else
return parameter_list
end
return parameter_list if max_param_number!=0 and j==i+max_param_number
end
end
end
return parameter_list
end
|
#yaxisIntersect(x1, y1, x2, y2, px, py) ⇒ Object
1
2
3
4
5
6
7
|
# File 'scripts/PokeBattle_AnimationPlayer.rb', line 1
def yaxisIntersect(x1,y1,x2,y2,px,py)
dx=x2-x1
dy=y2-y1
x = (dx==0) ? 0.0 : (px-x1)*1.0/dx
y = (dy==0) ? 0.0 : (py-y1)*1.0/dy
return [x,y]
end
|
#zodiac(month, day) ⇒ Object
Calculates the zodiac sign based on the given month and day: 0 is Aries, 11 is Pisces. Month is 1 if January, and so on.
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'scripts/PField_Time.rb', line 177
def zodiac(month,day)
time=[
3,21,4,19, 4,20,5,20, 5,21,6,20, 6,21,7,20, 7,23,8,22, 8,23,9,22, 9,23,10,22, 10,23,11,21, 11,22,12,21, 12,22,1,19, 1,20,2,18, 2,19,3,20 ]
for i in 0...12
return i if month==time[i*4] && day>=time[i*4+1]
return i if month==time[i*4+2] && day<=time[i*4+2]
end
return 0
end
|
#zodiacComplements(sign) ⇒ Object
0 is Aries, 11 is Pisces.
211
212
213
|
# File 'scripts/PField_Time.rb', line 211
def zodiacComplements(sign)
return [(sign+1)%12,(sign+11)%12]
end
|
#zodiacOpposite(sign) ⇒ Object
Returns the opposite of the given zodiac sign. 0 is Aries, 11 is Pisces.
201
202
203
|
# File 'scripts/PField_Time.rb', line 201
def zodiacOpposite(sign)
return (sign+6)%12
end
|
#zodiacPartners(sign) ⇒ Object
0 is Aries, 11 is Pisces.
206
207
208
|
# File 'scripts/PField_Time.rb', line 206
def zodiacPartners(sign)
return [(sign+4)%12,(sign+8)%12]
end
|